uicc.scws
Interface HttpRequest


public interface HttpRequest

Interface providing the means to analyse the incoming HTTP request. The object implementing the HttpRequest interface is a Temporary Entry Point Object.


Method Summary
 short findAndCopyKeywordValue(byte[] headerKeywordName, short nameOffs, short nameLength, byte[] buffer, short bufferOffs, short maxLength)
          Find and copy the value of a header.
 short findAndCopyKeywordValue(short keywordId, byte[] buffer, short bufferOffs, short maxLength)
          Find and copy the value of a header or the value of a keyword/value part of the URI indicated by a keywordId.
 int getContentLength()
          Returns the length of the HTTP request content
 short getContentType()
          Returns the content-type keyword of the HTTP request
 short getRequestHttpVersion()
          Returns the version of the HTTP protocol of the current request.
 short readContent(int requestOffset, byte[] data, short offset, short len)
          Read a part of the request content.
 short readContentType(byte[] data, short offs, short len)
          Reads the content type given in the HTTP request (e.g.
 

Method Detail

findAndCopyKeywordValue

short findAndCopyKeywordValue(byte[] headerKeywordName,
                              short nameOffs,
                              short nameLength,
                              byte[] buffer,
                              short bufferOffs,
                              short maxLength)
                              throws java.lang.NullPointerException,
                                     java.lang.ArrayIndexOutOfBoundsException
Find and copy the value of a header.

Parameters:
headerKeywordName - buffer that contains the name of the requested header
nameOffs - offset within headerKeywordName
nameLength - length of data within headerKeywordName
buffer - buffer where the value shall be copied
bufferOffs - offset where the value shall be copied
maxLength - maximum length of the value that shall be copied
Returns:
bufferOffs+length of the copied value or KEYWORD_NOT_FOUND in case the keyword is not found
Throws:
java.lang.NullPointerException - if headerKeywordName or buffer is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the copy operation would cause access out of bounds

findAndCopyKeywordValue

short findAndCopyKeywordValue(short keywordId,
                              byte[] buffer,
                              short bufferOffs,
                              short maxLength)
                              throws ScwsException,
                                     java.lang.NullPointerException,
                                     java.lang.ArrayIndexOutOfBoundsException
Find and copy the value of a header or the value of a keyword/value part of the URI indicated by a keywordId. The supported keywords are defined in ScwsConstants Interface.

Parameters:
keywordId - value of the request header name or part of the URI
buffer - buffer where the value shall be copied
bufferOffs - offset where the value shall be copied
maxLength - maximum length of the value that shall be copied
Returns:
bufferOffs+length of the copied value or KEYWORD_NOT_FOUND in case the keyword is not found
Throws:
ScwsException - with reason UNKNOWN_KEYWORD_ID if the keywordId is not recognized
java.lang.NullPointerException - if buffer is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the copy operation would cause access out of bounds
See Also:
ScwsConstants

getContentLength

int getContentLength()
Returns the length of the HTTP request content

Returns:
content length of the request.

getRequestHttpVersion

short getRequestHttpVersion()
Returns the version of the HTTP protocol of the current request.

Returns:
HTTP version of the request or KEYWORD_NOT_FOUND in case the content type header field is not present, or CONTENT_TYPE_UNKNOWN in case the content type doesn't match one of the possible content type keywords defined in ScwsConstants.

getContentType

short getContentType()
Returns the content-type keyword of the HTTP request

Returns:
the content type of the request.
See Also:
ScwsConstants

readContentType

short readContentType(byte[] data,
                      short offs,
                      short len)
                      throws java.lang.NullPointerException,
                             java.lang.ArrayIndexOutOfBoundsException
Reads the content type given in the HTTP request (e.g. content type: text/html will write text/html into the buffer).

Parameters:
data - buffer to hold the content type from the request.
offs - start in the buffer to hold the content type.
len - maximum length of the content type to be copied
Returns:
offs+length of the copied value.
Throws:
java.lang.NullPointerException - if data is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the read operation would cause access out of bounds

readContent

short readContent(int requestOffset,
                  byte[] data,
                  short offset,
                  short len)
                  throws ScwsException,
                         java.lang.NullPointerException,
                         java.lang.ArrayIndexOutOfBoundsException
Read a part of the request content.

Parameters:
requestOffset - Offset within the HTTP request to start reading the request content.
data - byte array where request content shall be copied.
offset - offset within buffer.
len - maximum length of the content to be copied.
Returns:
offset+length of the copied value.
Throws:
ScwsException - with reason UNREACHABLE_OFFSET if the requested offset could not be reached.
java.lang.NullPointerException - if data is equal to null
java.lang.ArrayIndexOutOfBoundsException - if the read operation would cause access out of bounds