org.xlightweb
Interface IHttpMessage

Package class diagram package IHttpMessage
All Superinterfaces:
IHeader, IPart
All Known Subinterfaces:
IHttpRequest, IHttpResponse
All Known Implementing Classes:
DeleteRequest, FormURLEncodedRequest, GetRequest, HeadRequest, HttpRequest, HttpRequestWrapper, HttpResponse, MultipartFormDataRequest, MultipartRequest, OptionsRequest, PostRequest, PutRequest

public interface IHttpMessage
extends IPart

Http Message


Field Summary
static String CONNECT_METHOD
           
static String DEFAULT_ENCODING
           
static String DEFAULT_ENCODING_KEY
           
static String DELETE_METHOD
           
static String GET_METHOD
           
static String HEAD_METHOD
           
static String OPTIONS_METHOD
           
static String POST_METHOD
           
static String PUT_METHOD
           
static String TRACE_METHOD
           
 
Method Summary
 Object getAttribute(String name)
          Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
 Enumeration getAttributeNames()
          Returns an Enumeration containing the names of the attributes available to this message.
 Set<String> getAttributeNameSet()
          Returns an Set containing the names of the attributes available to this messaget.
 String getCharacterEncoding()
          Returns the name of the character encoding used in the body of this message.
 int getContentLength()
          Returns the length, in bytes, of the message body and made available by the input stream, or -1 if the length is not known.
 String getContentType()
          Returns the MIME type of the body of the messag, or null if the type is not known.
 IHttpMessageHeader getMessageHeader()
          returns the message header
 String getProtocol()
          Returns the name and version of the protocol the message uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
 String getProtocolVersion()
          Returns the version of the protocol the message uses in the form majorVersion.minorVersion, for example, 1.1.
 String getTransferEncoding()
          returns the Transfer-Encoding header parameter or null if the header is not set
 void removeHopByHopHeaders()
          removes all hop-by-hop headers without Transfer-Encoding if set to chunked
 void setAttribute(String name, Object o)
          Stores an attribute in this header.
 void setContentLength(int length)
          sets the content length in bytes
 void setContentType(String type)
          sets the MIME type of the body of the message
 void setTransferEncoding(String transferEncoding)
          sets the Transfer-Encoding parameter
 
Methods inherited from interface org.xlightweb.IPart
getBlockingBody, getBody, getNonBlockingBody, getPartHeader, hasBody
 
Methods inherited from interface org.xlightweb.IHeader
addHeader, addHeaderLine, addHeaderlines, containsHeader, getDisposition, getDispositionParam, getDispositionType, getHeader, getHeaderList, getHeaderNames, getHeaderNameSet, getHeaders, removeHeader, setHeader
 

Field Detail

DEFAULT_ENCODING_KEY

static final String DEFAULT_ENCODING_KEY
See Also:
Constant Field Values

DEFAULT_ENCODING

static final String DEFAULT_ENCODING

GET_METHOD

static final String GET_METHOD
See Also:
Constant Field Values

POST_METHOD

static final String POST_METHOD
See Also:
Constant Field Values

HEAD_METHOD

static final String HEAD_METHOD
See Also:
Constant Field Values

PUT_METHOD

static final String PUT_METHOD
See Also:
Constant Field Values

DELETE_METHOD

static final String DELETE_METHOD
See Also:
Constant Field Values

TRACE_METHOD

static final String TRACE_METHOD
See Also:
Constant Field Values

CONNECT_METHOD

static final String CONNECT_METHOD
See Also:
Constant Field Values

OPTIONS_METHOD

static final String OPTIONS_METHOD
See Also:
Constant Field Values
Method Detail

getContentLength

int getContentLength()
Returns the length, in bytes, of the message body and made available by the input stream, or -1 if the length is not known.

Returns:
an integer containing the length of the message body or -1 if the length is not known

setContentLength

void setContentLength(int length)
sets the content length in bytes

Parameters:
length - the content length in bytes

setContentType

void setContentType(String type)
sets the MIME type of the body of the message

Specified by:
setContentType in interface IHeader
Parameters:
type - the MIME type of the body of the message

getContentType

String getContentType()
Returns the MIME type of the body of the messag, or null if the type is not known.

Specified by:
getContentType in interface IHeader
Returns:
a String containing the name of the MIME type of the message, or null if the type is not known

getTransferEncoding

String getTransferEncoding()
returns the Transfer-Encoding header parameter or null if the header is not set

Specified by:
getTransferEncoding in interface IHeader
Returns:
the Transfer-Encoding header parameter or null if the header is not set

setTransferEncoding

void setTransferEncoding(String transferEncoding)
sets the Transfer-Encoding parameter

Specified by:
setTransferEncoding in interface IHeader
Parameters:
transferEncoding - the Transfer-Encoding parameter

getCharacterEncoding

String getCharacterEncoding()
Returns the name of the character encoding used in the body of this message. If the header defines no encoding, the default encoding will be returned

Specified by:
getCharacterEncoding in interface IHeader
Returns:
a String containing the name of the character encoding

getMessageHeader

IHttpMessageHeader getMessageHeader()
returns the message header

Returns:
the message header

getProtocol

String getProtocol()
Returns the name and version of the protocol the message uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.

Returns:
a String containing the protocol name and version number

getProtocolVersion

String getProtocolVersion()
Returns the version of the protocol the message uses in the form majorVersion.minorVersion, for example, 1.1.

Returns:
a String containing the protocol version number

setAttribute

void setAttribute(String name,
                  Object o)
Stores an attribute in this header. Attributes are reset between messages.

Attribute names should follow the same conventions as package names.

Parameters:
name - a String specifying the name of the attribute
o - the Object to be stored

getAttribute

Object getAttribute(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.

Attribute names should follow the same conventions as package names.

Parameters:
name - a String specifying the name of the attribute
Returns:
an Object containing the value of the attribute, or null if the attribute does not exist

getAttributeNames

Enumeration getAttributeNames()
Returns an Enumeration containing the names of the attributes available to this message. This method returns an empty Enumeration if the message has no attributes available to it.

Returns:
an Enumeration of strings containing the names of the message's attributes

getAttributeNameSet

Set<String> getAttributeNameSet()
Returns an Set containing the names of the attributes available to this messaget. This method returns an empty Set if the request has no attributes available to it.

Returns:
an Set of strings containing the names of the message's attributes

removeHopByHopHeaders

void removeHopByHopHeaders()
removes all hop-by-hop headers without Transfer-Encoding if set to chunked