|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.httpd.AbstractPreparedResponse
public abstract class AbstractPreparedResponse
This interface is meant to wrap prepared HTTP reply objects.
Constructor Summary | |
---|---|
AbstractPreparedResponse(HTTPHandler handler,
HTTPHeaders requestHeaders,
java.util.UUID socketID,
java.net.Socket socket,
java.util.UUID sessionID,
int statusCode,
java.lang.String reasonPhrase)
Create a new prepared response. |
Method Summary | |
---|---|
void |
addResponseHeader(java.lang.String key,
java.lang.String value)
Add a new line (key-value-pair) to the response headers. |
abstract void |
dispose()
This method will be called in the final end - even if the execute() method failed. |
void |
execute()
This method executes the prepared reply; this means that all necessary resources will be accessed, the actual reply built and sent back to the client. |
protected HTTPHandler |
getHTTPHandler()
Get this response's HTTP handler. |
java.lang.String |
getReasonPhrase()
Get the currently set reason phrase. |
protected HTTPHeaders |
getRequestHeaders()
Get this respone's HTTP request headers. |
Resource |
getResponseDataResource()
|
HTTPHeaders |
getResponseHeaders()
These headers are initially empty and need to be filled with the response header data. |
protected java.util.UUID |
getSessionID()
Get the connection's session ID |
protected java.net.Socket |
getSocket()
Get the actual connection socket. |
protected java.util.UUID |
getSocketID()
Get the server side socket ID. |
java.lang.String |
getStatusCode()
Get the status code of this prepared response. |
boolean |
isDisposed()
The method returns true if (and only if) this response already disposed. |
boolean |
isExecuted()
The method returns true if (and only if) this response was already executed. |
boolean |
isPrepared()
This method return true if (and only if) this response is already prepared. |
abstract void |
prepare(java.util.Map<java.lang.String,BasicType> optionalReturnSettings)
This method must be implemented by all subclasses. |
protected void |
setDisposed()
|
protected void |
setPrepared()
|
protected void |
setReasonPhrase(java.lang.String phrase)
Set the reason phrase to a new value. |
void |
setResponseDataResource(Resource resource)
|
protected void |
setStatusCode(java.lang.String statusCode)
Set the status code to a new value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractPreparedResponse(HTTPHandler handler, HTTPHeaders requestHeaders, java.util.UUID socketID, java.net.Socket socket, java.util.UUID sessionID, int statusCode, java.lang.String reasonPhrase) throws java.lang.IllegalArgumentException
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!).
java.lang.IllegalArgumentException
- If the reaons phrase contains line breaks.Method Detail |
---|
protected HTTPHandler getHTTPHandler()
protected HTTPHeaders getRequestHeaders()
protected java.util.UUID getSocketID()
protected java.net.Socket getSocket()
protected java.util.UUID getSessionID()
public HTTPHeaders getResponseHeaders()
public void addResponseHeader(java.lang.String key, java.lang.String value)
public void setResponseDataResource(Resource resource)
public Resource getResponseDataResource()
protected void setPrepared()
protected void setDisposed()
public java.lang.String getStatusCode()
protected void setStatusCode(java.lang.String statusCode)
public java.lang.String getReasonPhrase()
protected void setReasonPhrase(java.lang.String phrase) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public abstract 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
prepare
in interface PreparedHTTPResponse
optionalReturnSettings
- This (optional, means may be null) map can be used to retrieve internal values
for error recovery.
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
public final void execute() throws java.io.IOException
execute
in interface PreparedHTTPResponse
java.io.IOException
- If any IO errors occur.public abstract void dispose()
dispose
in interface PreparedHTTPResponse
public boolean isPrepared()
isPrepared
in interface PreparedHTTPResponse
public boolean isExecuted()
isExecuted
in interface PreparedHTTPResponse
public boolean isDisposed()
isDisposed
in interface PreparedHTTPResponse
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |