org.xlightweb
Interface IHttpMessageHeader

Package class diagram package IHttpMessageHeader
All Superinterfaces:
IHeader
All Known Subinterfaces:
IHttpRequestHeader, IHttpResponseHeader
All Known Implementing Classes:
HttpRequestHeader, HttpRequestHeaderWrapper, HttpRequestWrapper, HttpResponseHeader

public interface IHttpMessageHeader
extends IHeader

Http Header


Field Summary
static String DEFAULT_ENCODING
           
 
Method Summary
 IHttpMessageHeader copy()
          creates a copy of this header
 void copyHeaderFrom(IHttpMessageHeader otherHeader, String... upperExcludenames)
          copy the headers
 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.
 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 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.
 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
 
Methods inherited from interface org.xlightweb.IHeader
addHeader, addHeaderLine, addHeaderlines, containsHeader, getCharacterEncoding, getContentType, getDisposition, getDispositionParam, getDispositionType, getHeader, getHeaderList, getHeaderNames, getHeaderNameSet, getHeaders, getTransferEncoding, removeHeader, setContentType, setHeader, setTransferEncoding
 

Field Detail

DEFAULT_ENCODING

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

copy

IHttpMessageHeader copy()
creates a copy of this header

Returns:
return the copy

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

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

copyHeaderFrom

void copyHeaderFrom(IHttpMessageHeader otherHeader,
                    String... upperExcludenames)
copy the headers

Parameters:
otherHeader - the other header
upperExcludenames - the header names to exclude

removeHopByHopHeaders

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