|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface HttpResponse
Interface providing the means to build a HTTP response. The object
implementing the HttpResponse interface is a Temporary Entry Point Object.
| Method Summary | |
|---|---|
void |
appendContent(byte[] data,
short offset,
short length)
Writes the content of data into the response object. |
void |
appendHeaderVariable(byte[] data,
short offset,
short length)
Writes a header variable to outgoing buffer (e.g. |
void |
appendHeaderVariable(byte[] name,
short nameOffset,
short nameLength,
byte[] value,
short valueOffset,
short valueLength)
Appends a header variable to outgoing buffer (e.g. |
void |
appendHeaderVariable(short headerKeywordNameId,
byte[] value,
short valueOffset,
short valueLength)
Appends a header variable to the outgoing buffer (e.g. |
void |
enableChunkMode()
Informs the SCWS to use the chunked mode for sending the response, chunked mode off is the default mode |
void |
finalizeHeader()
Finalizes the header data in the outgoing buffer. |
void |
flush()
Sends all data contained in the HTTP response. |
int |
getRemainingResponseBufferSize()
Returns the remaining size of the Response Buffer available for this applet. |
void |
reset()
Clears the Response Buffer content and reset the state of the HttpResponse Object to its initial
state. |
void |
sendError(short errorCode)
Sends an error code to the SCWS. |
void |
setContentType(short type)
Sets the content type of the HTTP response |
void |
writeStatusCode(short code)
Write an HTTP status code into the outgoing buffer (e.g. |
| Method Detail |
|---|
void finalizeHeader()
throws ScwsException
ScwsException - with reason codes:
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
BUFFER_OVERFLOW if the adding of missing header data would cause
access outside the Response buffer.
void appendHeaderVariable(byte[] name,
short nameOffset,
short nameLength,
byte[] value,
short valueOffset,
short valueLength)
throws ScwsException,
java.lang.NullPointerException,
java.lang.ArrayIndexOutOfBoundsException
The header variables content-length or transfer-encoding are inserted by the framework depending on the transfer mode
name - buffer containing the header name (for example "content-type")nameOffset - offset within name buffernameLength - length of the value within name buffervalue - buffer containing the header value (for example "text/html")valueOffset - offset within value buffervalueLength - length of the value within value buffer
java.lang.NullPointerException - if name or value is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the operation would cause access outside array bounds
ScwsException - with reason codes:
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
BUFFER_OVERFLOW If appending the header variable
would cause an overflow of the response buffer.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
void appendHeaderVariable(short headerKeywordNameId,
byte[] value,
short valueOffset,
short valueLength)
throws ScwsException,
java.lang.NullPointerException,
java.lang.ArrayIndexOutOfBoundsException
The header variables content-length or transfer-encoding are inserted by the framework depending on the transfer mode
headerKeywordNameId - Identifier of the required header name.value - buffer containing the header value (for example "text/html").valueOffset - offset within value buffer.valueLength - length of the value within value buffer.
java.lang.NullPointerException - if value is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the operation would cause access outside array bounds
ScwsException - with reason codes:
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
UNKNOWN_KEYWORD_ID if the headerKeywordNameId
is not correct according to SCWSConstants
BUFFER_OVERFLOW If appending the header variable
would cause an overflow of the response buffer.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
void appendHeaderVariable(byte[] data,
short offset,
short length)
throws ScwsException,
java.lang.NullPointerException,
java.lang.ArrayIndexOutOfBoundsException
The header variables content-length or transfer-encoding are inserted by the framework depending on the transfer mode
data - buffer holding the header variableoffset - start offset of the header variable in the data bufferlength - the length of the header variable in the buffer
java.lang.NullPointerException - if data is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the operation would cause access outside array bounds
ScwsException - with reason codes:
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
BUFFER_OVERFLOW If appending the header variable
would cause an overflow of the response buffer.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
void appendContent(byte[] data,
short offset,
short length)
throws ScwsException,
java.lang.NullPointerException,
java.lang.ArrayIndexOutOfBoundsException
data into the response object.
Invoking this method implicitly finalizes the header of the
HttpResponse.
In case of chunked transfer encoding hex length of chunked data is automatically
added by the framework.
data - buffer holding the content of the responseoffset - start offset of the content in the data bufferlength - the length of the content in the buffer
java.lang.NullPointerException - if data is equal to null.
java.lang.ArrayIndexOutOfBoundsException - if the operation would cause access outside array bounds
ScwsException - with reason codes:
BUFFER_OVERFLOW If appending the content
in fixed buffer size mode would cause an overflow of
the response buffer.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
void writeStatusCode(short code)
throws ScwsException
code - status code of the HTTP 1.1 protocol
ScwsException - with reason code
HEADER_ALREADY_FINALIZEDif the HTTP header was already finalized
STATUS_LINE_ALREADY_SET if the writeStatusCode or the
appendHeaderVariable has already been invoked
HTTP_RESPONSE_ALREADY_SENT if the flush or
sendError method was called previously
HTTP_CODE_UNKNOWN if the status code is unknown with respect to the HTTP
1.1 protocol
void flush()
Invoking this method for the first time implicitly finalizes the header of the
HttpResponse.
ScwsException - with reason codes: BUFFER_OVERFLOW if the adding of missing header data would cause
access outside the Response buffer. void sendError(short errorCode)
Invoking this method implicitly finalizes the header of the
HttpResponse.
errorCode - The error code to be sent in the HTTP Response.
//@exception ScwsException with reason code
// HTTP_CODE_UNKNOWN if the error code is unknown with respect to the HTTP
// 1.1 protocol
ScwsException - with reason codes:
HTTP_CODE_UNKNOWN if the error code is unknown with respect to the HTTP
1.1 protocol
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
int getRemainingResponseBufferSize()
The size returned by this method is guaranteed until the next header data or content data is added to the Response Buffer.
ScwsException - with reason codes:
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously and the selected transfer mode is Fixed transfer mode
void enableChunkMode()
This allows the SCWS to handle large ammounts of response data
ScwsException - with reason codes:
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously
void setContentType(short type)
throws ScwsException
type - the content-type keyword ID of the response
ScwsException - with reason codes:
UNKNOWN_KEYWORD_ID if type is unknown.
HEADER_ALREADY_FINALIZED if the HTTP header was
already finalized.
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously.
BUFFER_OVERFLOW if the adding of header data would cause
access outside the Response buffer.
void reset()
throws ScwsException
HttpResponse Object to its initial
state. All the header variables and content that was appended to the HttpResponse until the
invocation of the reset method is lost.
ScwsException - with reason codes:
HTTP_RESPONSE_ALREADY_SENT if the
flush or sendError method was called
previously or the method enableChunkMode was already invoked.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||