ikrs.httpd.response
Class GeneralPreparedResponse

java.lang.Object
  extended by ikrs.httpd.AbstractPreparedResponse
      extended by ikrs.httpd.response.GeneralPreparedResponse
All Implemented Interfaces:
PreparedHTTPResponse
Direct Known Subclasses:
OK

public class GeneralPreparedResponse
extends AbstractPreparedResponse

This class holds general prepared responses. The response requires: - STATUS_CODE Optional is the RESOURCE.


Constructor Summary
GeneralPreparedResponse(HTTPHandler handler, HTTPHeaders headers, java.util.UUID socketID, java.net.Socket socket, java.util.UUID sessionID, int statusCode, java.lang.String reasonPhrase)
          Create a new general prepared response.
 
Method Summary
 void dispose()
          This method will be called in the final end - even if the execute() method failed.
 void prepare(java.util.Map<java.lang.String,BasicType> optionalReturnSettings)
          This method must be implemented by all subclasses.
 
Methods inherited from class ikrs.httpd.AbstractPreparedResponse
addResponseHeader, execute, getHTTPHandler, getReasonPhrase, getRequestHeaders, getResponseDataResource, getResponseHeaders, getSessionID, getSocket, getSocketID, getStatusCode, isDisposed, isExecuted, isPrepared, setDisposed, setPrepared, setReasonPhrase, setResponseDataResource, setStatusCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralPreparedResponse

public GeneralPreparedResponse(HTTPHandler handler,
                               HTTPHeaders headers,
                               java.util.UUID socketID,
                               java.net.Socket socket,
                               java.util.UUID sessionID,
                               int statusCode,
                               java.lang.String reasonPhrase)
                        throws java.lang.IllegalArgumentException
Create a new general prepared response.

Parameters:
handler - The top level HTTP handler.
headers - The request (!) headers.
socketID - The (server) socket ID.
socket - The connection's socket.
statusCode - The response's status code.
reasonPhrase - The reason phrase (must not contain line breaks!).
Throws:
java.lang.IllegalArgumentException - If the reaons phrase contains line breaks.
Method Detail

prepare

public void prepare(java.util.Map<java.lang.String,BasicType> optionalReturnSettings)
             throws MalformedRequestException,
                    UnsupportedVersionException,
                    UnsupportedMethodException,
                    UnknownMethodException,
                    ConfigurationException,
                    java.util.MissingResourceException,
                    AuthorizationException,
                    HeaderFormatException,
                    DataFormatException,
                    UnsupportedFormatException,
                    ParametrizedHTTPException,
                    java.lang.SecurityException,
                    java.io.IOException
This method must be implemented by all subclasses. It must prepare the HTTP response. This means that all required ressources must be acquired (use locks), all headers prepared (by the use of addResponseHeader(String,String) or getResponseHeaders()) and perform all necessary security checks. Subclasses implementing this method should call the setPrepared() method when ready.

Specified by:
prepare in interface PreparedHTTPResponse
Specified by:
prepare in class AbstractPreparedResponse
Parameters:
optionalReturnSettings - This (optional, means may be null) map can be used to retrieve internal values for error recovery.
Throws:
MalformRequestException - If the passed HTTP request headers are malformed and cannot be processed.
UnsupportedVersionException - If the headers' HTTP version is not supported (supported versions are 1.0 and 1.1).
UnsupportedMethodException - If the request method is valid but not supported (status code 405).
UnknownMethodException - If the headers' method (from the request line) is unknown.
ConfigurationException - If the was a server configuration issue the server cannot work properly with.
java.util.MissingResourceException - If the requested resource cannot be found.
AuthorizationException - If the requested resource requires authorization.
HeaderFormatException - If the passed headers are malformed.
DataFormatException - If the passed data is malformed.
java.lang.SecurityException - If the request cannot be processed due to security reasons.
java.io.IOException - If any IO errors occur.
MalformedRequestException
UnsupportedFormatException
ParametrizedHTTPException

dispose

public void dispose()
This method will be called in the final end - even if the execute() method failed. Subclasses implementing this method should call the setDisposed() method when done. It has to clean up, release resources and all locks!

Specified by:
dispose in interface PreparedHTTPResponse
Specified by:
dispose in class AbstractPreparedResponse