## org.w3c.www.http
Class HttpMessage

    java.lang.Object
      |
      +--org.w3c.www.http.HttpMessage

Direct Known Subclasses:
  HttpEntityMessage

public class HttpMessage
extends java.lang.Object
implements MimeHeaderHolder, java.lang.Cloneable, HTTP

The basic class for all HTTP messages, as define in the HTTP spec. This class is the base class for a number of other classes, including both the ingoing/outgoing requests and replies.

Field Summary
`protected static HeaderDescription[]` `descriptors`
`static int` `EMIT_ALL`
`static int` `EMIT_BODY`
`static int` `EMIT_FOOTERS`
`static int` `EMIT_HEADERS`
`protected long` `emitdate` The date at which this message was last emitted.
`protected static java.util.Hashtable` `factory` The header value factory.
`static int` `H_CACHE_CONTROL`
`static int` `H_CMAN_EXT`
`static int` `H_CONNECTION`
`static int` `H_COOKIE`
`static int` `H_COPT_EXT`
`static int` `H_DATE`
`static int` `H_MAN_EXT`
`static int` `H_OPT_EXT`
`static int` `H_PRAGMA`
`static int` `H_PROTOCOL`
`static int` `H_PROTOCOL_INFO`
`static int` `H_PROTOCOL_QUERY`
`static int` `H_PROTOCOL_REQUEST`
`static int` `H_PROXY_CONNECTION`
`static int` `H_SET_COOKIE`
`static int` `H_TRAILER`
`static int` `H_TRANSFER_ENCODING`
`static int` `H_UPGRADE`
`static int` `H_VIA`
`protected java.util.Dictionary` `headers` The header value repository.
`protected short` `major` The major version of this message, according to HTTP specs.
`static int` `MAX_HEADERS`
`protected short` `minor` The minoir version of this message, according to HTTP specs.
`protected ArrayDictionary` `state` The state dictionary.
`protected HeaderValue[]` `values`

Fields inherited from interface org.w3c.www.http.HTTP

`ACCEPTED, BAD_GATEWAY, BAD_REQUEST, byteArrayVersion, CONFLICT, CONNECT, CONTINUE, CREATED, DELETE, DONE, EXPECTATION_FAILED, FORBIDDEN, FOUND, GATEWAY_TIMEOUT, GET, GONE, HEAD, HTTP_100_CONTINUE, HTTP_VERSION_NOT_SUPPORTED, INTERNAL_SERVER_ERROR, LENGTH_REQUIRED, major_number, minor_number, MOVED_PERMANENTLY, msg_100, msg_200, msg_300, msg_400, msg_500, MULTIPLE_CHOICE, NO_CONTENT, NOHEADER, NON_AUTHORITATIVE_INFORMATION, NOT_ACCEPTABLE, NOT_ALLOWED, NOT_EXTENDED, NOT_FOUND, NOT_IMPLEMENTED, NOT_MODIFIED, OK, OPTIONS, PARTIAL_CONTENT, PAYMENT_REQUIRED, POST, PRECONDITION_FAILED, PROXY_AUTH_REQUIRED, PUT, REQUEST_ENTITY_TOO_LARGE, REQUEST_TIMEOUT, REQUEST_URI_TOO_LONG, REQUESTED_RANGE_NOT_SATISFIABLE, RESET_CONTENT, SEE_OTHER, SERVICE_UNAVAILABLE, SWITCHING, TEMPORARY_REDIRECT, TRACE, UNAUTHORIZED, UNSUPPORTED_MEDIA_TYPE, USE_PROXY`

Constructor Summary
`HttpMessage()`
`HttpMessage(MimeParser parser)`

Method Summary
`void` `addConnection(java.lang.String name)` Add the given header name to the `Connection` header.
`void` `addNoCache(java.lang.String name)` Add the given header name to the `no-cache` directive.
`void` `addPragma(java.lang.String name)` Add the given directive to the `Pragma` header.
`void` `addProxyConnection(java.lang.String name)` Add the given header name to the `Proxy-Connection` header.
`void` `addTransferEncoding(java.lang.String name)` Add an encoding token to the given reply stream (ie the body).
`void` `addVia(java.lang.String via)` Add a via clause to the via header.
`boolean` `checkNoStore()` Check the `no-store` directive of the cache control header.
`boolean` `checkOnlyIfCached()` Check the `only-if-cached` directive.
`void` `delState(java.lang.String name)` State management - Remove a piece of state from this request.
`void` `dump(java.io.OutputStream out)`
`void` `emit(java.io.OutputStream out)` Emit this message to the given output stream.
`void` `emit(java.io.OutputStream out, int what)`
`protected void` `emitHeaders(java.io.OutputStream out, int what)` Emit the headers.
`protected void` `endEmit(java.io.OutputStream out, int what)` This message has been emited.
`java.util.Enumeration` `enumerateHeaderDescriptions()` Enumerate all the headers defined for that message.
`java.util.Enumeration` `enumerateHeaderDescriptions(boolean all)` Enumerate all the available headers for that message.
`protected java.lang.String` `generateExtNamespace()` get a new namespace.
`HttpCacheControl` `getCacheControl()` Header accessor - get the cache control policy.
`HttpMessage` `getClone()` Get a clone of this HTTP message.
`java.lang.String` `getCManExtHeader(java.lang.String ext, java.lang.String header)` get the String value of the given header relative to the given Extension.
`java.lang.String[]` `getConnection()` Header accessor - get the connection header value.
`HttpCookieList` `getCookie()` Get the cookies attached to that message.
`java.lang.String` `getCOptExtHeader(java.lang.String ext, java.lang.String header)` get the String value of the given header relative to the given Extension.
`long` `getDate()` Header accessor - get the date of this message.
`long` `getEmitDate()` Get the date at which this message was last emitted, if ever it was.
`java.util.Dictionary` `getExtensionHeaders(HttpExt ext)` Get the headers relative to the given Http Extension declaration.
`java.lang.String` `getExtHeader(java.lang.String ext, java.lang.String header)` get the String value of the given header relative to the given Extension.
`HttpExtList` `getExtList(java.lang.String id)` Get an Http Extension Listfrom the following list: Mandatory (End-to-End) Extensions Mandatory (Hop-by-Hop) Extensions Optionnal (End-to-End) Extensions Optionnal (hop-by-Hop) Extensions
`HeaderValue` `getHeaderValue(HeaderDescription d)` Get a header value, keyed by it's header description.
`HeaderValue` `getHeaderValue(int idx)` Fast access to header value.
`HeaderValue` `getHeaderValue(java.lang.String name)` Get a header value by name.
`HeaderValue` `getHeaderValue(java.lang.String name, HeaderValue def)` Get a header value, given its name.
`HttpExtList` `getHttpCManExtDecl()` Get The Mandatory (Hop-by-Hop) Extension declaration list.
`HttpExtList` `getHttpCOptExtDecl()` Get The Optionnal (Hop-by-Hop) Extension declaration list.
`HttpExtList` `getHttpManExtDecl()` Get The Mandatory (End-to-End) Extension declaration list.
`HttpExtList` `getHttpOptExtDecl()` Get The Optionnal (End-to-End) Extension declaration list.
`short` `getMajorVersion()` Get the major version number of this message.
`java.lang.String` `getManExtHeader(java.lang.String ext, java.lang.String header)` get the String value of the given header relative to the given Extension.
`int` `getMaxAge()` Get the `max-age` value for the current cache control.
`short` `getMinorVersion()` Get the minor version number of this message.
`java.lang.String[]` `getNoCache()` Get the `no-cache` directive of the cache control header.
`java.lang.String` `getOptExtHeader(java.lang.String ext, java.lang.String header)` get the String value of the given header relative to the given Extension.
`java.lang.String[]` `getPragma()` Header accessor - get the pragmas applicable to this message.
`HttpBag` `getProtocol()` Get the set of protocol extensions that have been applied to that that message.
`HttpBag` `getProtocolInfo()` Get the protocol extensions informations carried by this message.
`HttpBag` `getProtocolQuery()` Get the set of protocol extensions that are queried through this message.
`HttpBag` `getProtocolRequest()` Get the set of protocol extensions requested by this message.
`java.lang.String[]` `getProxyConnection()` Header accessor - get the proxy connection header value.
`HttpSetCookieList` `getSetCookie()` Get the value of the SetCookie header.
`int` `getSMaxAge()` Get the `s-maxage` value for the current cache control.
`java.lang.Object` `getState(java.lang.String name)` State management - Lookup the value of a state on this request.
`java.util.Enumeration` `getStateNames()` Get an enumeration of the states names.
`java.lang.String[]` `getTrailer()` Get this message trailer
`java.lang.String[]` `getTransferEncoding()` Header accessor - get the transfer encoding applying to this message.
`java.lang.String[]` `getUpgrade()` Header accessor - get the upgrade header of this message.
`java.lang.String` `getValue(HeaderDescription d)` Get a header field value as a String.
`java.lang.String` `getValue(java.lang.String name)` Get a header field value as a String.
`java.lang.String` `getVersion()` Get the String identifying the HTTP version used for this message.
`java.lang.String[]` `getVia()` Header accessor - get the via header of this message.
`boolean` `hasConnection(java.lang.String tok)` Does the connection header include the given token ?
`boolean` `hasHeader(int idx)` Probe this message for a defined header, fast access !
`boolean` `hasHeader(java.lang.String name)` Probe this message for a defined header.
`boolean` `hasPragma(java.lang.String pragma)` Header accessor - Check for a given pragma.
`boolean` `hasProxyConnection(java.lang.String tok)` Does the proxy connection header defines the given token.
`boolean` `hasState(java.lang.String name)` State management - Is the given state defined for the message ?
`boolean` `hasTransferEncoding(java.lang.String encoding)` Header accessor - Check for a given transfer encoding.
`boolean` `notifyBeginParsing(MimeParser parser)` MimeHeaderHolder implementation - HTTP message about to be parsed.
`void` `notifyEndParsing(MimeParser parser)` MimeHeaderHolder implementation - HTTP message parsing done.
`void` `notifyHeader(java.lang.String name, byte[] buf, int off, int len)` MimeHeaderHolder implementation - The MIME parser callback.
`static void` `registerExtHeader(java.lang.String name, java.lang.String cls)`
`protected static void` `registerHeader(java.lang.String name, java.lang.String cls)`
`protected static void` `registerHeader(java.lang.String name, java.lang.String c, int i)`
`void` `removeHeader(int idx)` Remove a header, by address.
`void` `removeHeader(java.lang.String name)` Remove a header, by name.
`void` `setCacheControl(HttpCacheControl control)` Header accessor - set the cache control associated with the message.
`void` `setConnection(java.lang.String[] tokens)` Header accessor - set the connection header value.
`void` `setCookie(HttpCookieList cookie)` Set the cookies attached to this message.
`void` `setDate(long date)` Header accessor - set the date of this message.
`void` `setEnd2EndExtensionAcknowledgmentHeader()`
`void` `setExtensionHeader(HttpExt ext, java.lang.String name, java.lang.String value)` Set an extension header relative to the given extension declaration.
`void` `setHeaderValue(HeaderDescription d, HeaderValue v)` Set a header value, keyed by it's header description.
`void` `setHeaderValue(int idx, HeaderValue value)` Fast write accessor to headers.
`void` `setHeaderValue(java.lang.String name, HeaderValue value)` Set a header value.
`void` `setHopByHopExtensionAcknowledgmentHeader()`
`void` `setHttpCManExtDecl(HttpExtList exts)` Set The Mandatory (Hop-by-Hop) Extension declaration list.
`void` `setHttpCOptExtDecl(HttpExtList exts)` Set The Optional (Hop-by-Hop) Extension declaration list.
`void` `setHttpExtDecl(HttpExtList exts)` Set the Extension declaration.
`void` `setHttpManExtDecl(HttpExtList exts)` Set The Mandatory (End-to-End) Extension declaration list.
`void` `setHttpOptExtDecl(HttpExtList exts)` Set The Optional (End-to-End) Extension declaration list.
`void` `setMaxAge(int maxage)` Set the `max-age` value of the associated cache control.
`protected void` `setNamespaces(HttpExtList extl)`
`void` `setNoCache()` Set the `no-cache` directive globally.
`void` `setNoCache(java.lang.String[] nocache)` Set the `no-cache` directive of the cache control header.
`void` `setNoStore(boolean onoff)` Set the `no-store` directive.
`void` `setOnlyIfCached(boolean onoff)` Set the `only-if-cached` directive.
`void` `setPragma(java.lang.String[] tokens)` Header accessor - set the pragmas applicable to this message.
`void` `setProtocol(HttpBag bag)` Set the protocol extensions applied to that message.
`void` `setProtocolInfo(HttpBag bag)` Attach protocol extensions informations to that message.
`void` `setProtocolQuery(HttpBag bag)` Set the protocol extensions queried by that message.
`void` `setProtocolRequest(HttpBag bag)` Set the protocol extensions required by this message.
`void` `setProxyConnection(java.lang.String[] tokens)` Header accessor - set the proxy connection header value.
`void` `setSetCookie(HttpSetCookieList setcookie)` Set the value of the Set-Cookie header.
`void` `setSMaxAge(int smaxage)` Set the `s-maxage` value of the associated cache control.
`void` `setState(java.lang.String name, java.lang.Object value)` State management - Add a piece of state to this request.
`void` `setTrailer(java.lang.String[] trailers)` Set this message trailer
`void` `setTransferEncoding(java.lang.String[] tokens)` Header accessor - set the transfer encoding for this message.
`void` `setUpgrade(java.lang.String[] products)` Header accessor - set the upgrade header of this message.
`void` `setValue(java.lang.String name, java.lang.String strval)` Define a new header field.
`void` `setVia(java.lang.String[] vias)` Header accessor - set the Via header of this message.
`protected void` `startEmit(java.io.OutputStream out, int what)` This message is about to be emited.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMIT_HEADERS

    public static final int EMIT_HEADERS

### EMIT_BODY

    public static final int EMIT_BODY

### EMIT_FOOTERS

    public static final int EMIT_FOOTERS

### EMIT_ALL

    public static final int EMIT_ALL

### H_CACHE_CONTROL

    public static int H_CACHE_CONTROL

### H_CONNECTION

    public static int H_CONNECTION

### H_PROXY_CONNECTION

    public static int H_PROXY_CONNECTION

### H_DATE

    public static int H_DATE

### H_PRAGMA

    public static int H_PRAGMA

### H_TRANSFER_ENCODING

    public static int H_TRANSFER_ENCODING

### H_UPGRADE

    public static int H_UPGRADE

### H_VIA

    public static int H_VIA

### H_PROTOCOL

    public static int H_PROTOCOL

### H_PROTOCOL_REQUEST

    public static int H_PROTOCOL_REQUEST

### H_PROTOCOL_INFO

    public static int H_PROTOCOL_INFO

### H_PROTOCOL_QUERY

    public static int H_PROTOCOL_QUERY

### H_SET_COOKIE

    public static int H_SET_COOKIE

### H_COOKIE

    public static int H_COOKIE

### H_TRAILER

    public static int H_TRAILER

### H_MAN_EXT

    public static int H_MAN_EXT

### H_OPT_EXT

    public static int H_OPT_EXT

### H_CMAN_EXT

    public static int H_CMAN_EXT

### H_COPT_EXT

    public static int H_COPT_EXT

### MAX_HEADERS

    public static int MAX_HEADERS

### factory

    protected static java.util.Hashtable factory

  The header value factory.

### headers

    protected java.util.Dictionary headers

  The header value repository. At this time, I am using this quite inefficient scheme, but the API have been carefully designed to enable a more efficient implementation.

### major

    protected short major

  The major version of this message, according to HTTP specs.

### minor

    protected short minor

  The minoir version of this message, according to HTTP specs.

### emitdate

    protected long emitdate

  The date at which this message was last emitted.

### state

    protected ArrayDictionary state

  The state dictionary.

### values

    protected HeaderValue[] values

### descriptors

    protected static HeaderDescription[] descriptors

Constructor Detail

### HttpMessage

    public HttpMessage(MimeParser parser)

### HttpMessage

    public HttpMessage()

Method Detail

### registerHeader

    protected static final void registerHeader(java.lang.String name,
                                               java.lang.String cls)

### registerHeader

    protected static final void registerHeader(java.lang.String name,
                                               java.lang.String c,
                                               int i)

### getHeaderValue

    public HeaderValue getHeaderValue(java.lang.String name,
                                      HeaderValue def)

  Get a header value, given its name.
  Parameters:
    `name` - The name of the field whose value is to be fetched.
    `def` - The default value if the field is undefined.

### getHeaderValue

    public final HeaderValue getHeaderValue(java.lang.String name)

  Get a header value by name.
  Parameters:
    `name` - The header's name.
  Returns:
    The value of the header, as a String, or null if undefined.

### getHeaderValue

    public final HeaderValue getHeaderValue(int idx)

  Fast access to header value.

  This method provides a very fast access to pre-defined header values. You can use it on all headers that have an access token.

  Parameters:
    `idx` - The token of the header to access.
  Returns:
    An instance of `HeaderValue` or null if undefined.

### setHeaderValue

    public void setHeaderValue(java.lang.String name,
                               HeaderValue value)

  Set a header value.
  Parameters:
    `name` - The name of the header to define.
    `value` - It's HeaderValue.

### getHeaderValue

    public HeaderValue getHeaderValue(HeaderDescription d)

  Get a header value, keyed by it's header description. This is usefull when enumerating headers, by the mean of `enumerateHeaderDescriptions`.
  Parameters:
    `d` - The header description.
  Returns:
    A HeaderValue instance, if the header is defined, null otherwise.

### setHeaderValue

    public void setHeaderValue(HeaderDescription d,
                               HeaderValue v)

  Set a header value, keyed by it's header description.
  Parameters:
    `d` - The header description.
    `v` - The HeaderValue instance, or null to reset the header value.

### setHeaderValue

    public final void setHeaderValue(int idx,
                                     HeaderValue value)

  Fast write accessor to headers.

  This method provides a very fast write access to header values. It can be used with any of the headers that have a pre-defined access token.

  Parameters:
    `idx` - The access token of the header's to write to.
    `value` - The new header value.

### removeHeader

    public void removeHeader(java.lang.String name)

  Remove a header, by name.
  Parameters:
    `name` - The name of the header to remove.

### removeHeader

    public final void removeHeader(int idx)

  Remove a header, by address. A fast version of the above.
  Parameters:
    `idx` - The index of the header to remove.

### enumerateHeaderDescriptions

    public java.util.Enumeration enumerateHeaderDescriptions(boolean all)

  Enumerate all the available headers for that message. This method returns an enumeration of HeaderDescription instances, which you can then use to access most efficiently header values.
  Parameters:
    `all` - If true the enumeration will cover all headers (even the ones that are not defined for that message) otherwise, it will cover only defined headers.
  Returns:
    An enumeration.

### enumerateHeaderDescriptions

    public java.util.Enumeration enumerateHeaderDescriptions()

  Enumerate all the headers defined for that message. This method returns an enumeration of HeaderDescription instances, which you can then use to access most efficiently header values.
  Returns:
    An enumeration.

### setState

    public void setState(java.lang.String name,
                         java.lang.Object value)

  State management - Add a piece of state to this request. If the piece of state already exists, it is overriden by the new value.
  Parameters:
    `name` - The name of the piece of state to define.
    `value` - It's corresponding value, or null to reset the value.

### getState

    public java.lang.Object getState(java.lang.String name)

  State management - Lookup the value of a state on this request.
  Parameters:
    `name` - The name of the piece of state to look for.
  Returns:
    An object, if the piece of state is defined, null otherwise.

### delState

    public void delState(java.lang.String name)

  State management - Remove a piece of state from this request.
  Parameters:
    `name` - The name of the piece of state to remove.

### hasState

    public boolean hasState(java.lang.String name)

  State management - Is the given state defined for the message ?
  Returns:
    A boolean true if the state is defined, false otherwise.

### getStateNames

    public java.util.Enumeration getStateNames()

  Get an enumeration of the states names.
  Returns:
    an Enumeration

### getClone

    public HttpMessage getClone()

  Get a clone of this HTTP message.
  Returns:
    An HttpMessage, of the class of the message receiver.

### getValue

    public java.lang.String getValue(java.lang.String name)

  Get a header field value as a String.
  Parameters:
    `name` - The name of the header.
  Returns:
    A String giving the header value, or null if undefined.

### getValue

    public java.lang.String getValue(HeaderDescription d)

  Get a header field value as a String.
  Parameters:
    `d` - The header description.
  Returns:
    The String value for the given header, or null if undefined.

### setValue

    public void setValue(java.lang.String name,
                         java.lang.String strval)

  Define a new header field.
  Parameters:
    `name` - The name of the header to be defined or reset.
    `value` - It's String value, or null to reset the value.

### hasHeader

    public boolean hasHeader(java.lang.String name)

  Probe this message for a defined header.
  Parameters:
    `name` - The name of the header to check.
  Returns:
    true if the header is defined, false otherwise.

### hasHeader

    public boolean hasHeader(int idx)

  Probe this message for a defined header, fast access !
  Parameters:
    `idx` - The index of the well-known header to check.
  Returns:
    true if the header is defined, false otherwise.

### notifyHeader

    public void notifyHeader(java.lang.String name,
                             byte[] buf,
                             int off,
                             int len)

  MimeHeaderHolder implementation - The MIME parser callback. This method is called if the HttpMessage is created by parsing an input stream. Each time the MIME parser detects a new header field, it calls back this method.
  Specified by:
    notifyHeader in interface MimeHeaderHolder
  Parameters:
    `name` - The name of the header that has been encountered.
    `buf` - The buffer containing the header value.
    `off` - The offset of the header value in the above buffer.
    `len` - The length of the header value in the above buffer.

### notifyBeginParsing

    public boolean notifyBeginParsing(MimeParser parser)
                               throws HttpParserException,
                                      java.io.IOException

  MimeHeaderHolder implementation - HTTP message about to be parsed. No further action is required at this point (we do not distinguish between request or reply here). The MIME parsing is to continue normally so we return false.
  Specified by:
    notifyBeginParsing in interface MimeHeaderHolder
  Returns:
    Always false to conotinue the MIME parsing.
  Throws:
    HttpParserException - if parsing failed.
    java.io.IOException - if an IO error occurs.

### notifyEndParsing

    public void notifyEndParsing(MimeParser parser)
                          throws HttpParserException,
                                 java.io.IOException

  MimeHeaderHolder implementation - HTTP message parsing done. Nothing special to be done here, return straight.
  Specified by:
    notifyEndParsing in interface MimeHeaderHolder
  Throws:
    HttpParserException - if parsing failed.
    java.io.IOException - if an IO error occurs.

### startEmit

    protected void startEmit(java.io.OutputStream out,
                             int what)
                      throws java.io.IOException

  This message is about to be emited. Take any appropriate actions.
  Throws:
    java.io.IOException - if an IO error occurs.

### endEmit

    protected void endEmit(java.io.OutputStream out,
                           int what)
                    throws java.io.IOException

  This message has been emited. Take any appropriate action.
  Throws:
    java.io.IOException - if an IO error occurs.

### emitHeaders

    protected void emitHeaders(java.io.OutputStream out,
                               int what)
                        throws java.io.IOException

  Emit the headers.
  Throws:
    java.io.IOException - if an IO error occurs.

### dump

    public void dump(java.io.OutputStream out)

### emit

    public void emit(java.io.OutputStream out)
              throws java.io.IOException

  Emit this message to the given output stream. This methods emits the given message to the stream, after invoking the `startEmit` method. Once the whole message has been emited, the `endEmit` method is called back.
  Parameters:
    `out` - The output stream to emit the message to.
  Throws:
    java.io.IOException - If the message couldn't be emited to the given stream, due to IO errors.

### emit

    public void emit(java.io.OutputStream out,
                     int what)
              throws java.io.IOException

  Parameters:
    `out` - The output stream to emit the message to.
    `what` - (fixme doc)
  Throws:
    java.io.IOException - If the message couldn't be emited to the given stream, due to IO errors.

### setCacheControl

    public void setCacheControl(HttpCacheControl control)

  Header accessor - set the cache control associated with the message. This method should not be used in general, it's much more preferable to use the various cache control accessors available.
  Parameters:
    `control` - The cache control policy, or null to reset the value.

### getCacheControl

    public HttpCacheControl getCacheControl()

  Header accessor - get the cache control policy.
  Returns:
    The current cache control policy, or null if undefined.

### setMaxAge

    public void setMaxAge(int maxage)

  Set the `max-age` value of the associated cache control. This method hides as much as possible, the difference between HTTP/1.1 max-age, and HTTP/1.0 expires headers. It will set only the appropriate one.
  Parameters:
    `maxage` - The max-age value, or -1 to reset the value.

### getMaxAge

    public int getMaxAge()

  Get the `max-age` value for the current cache control.
  Returns:
    The max age value, as an integer, or -1 if undefined.

### setSMaxAge

    public void setSMaxAge(int smaxage)

  Set the `s-maxage` value of the associated cache control. Set the s-maxage value on an HTTP/1.1 reply
  Parameters:
    `maxage` - The max-age value in seconds, or -1 to reset the value.

### getSMaxAge

    public int getSMaxAge()

  Get the `s-maxage` value for the current cache control.
  Returns:
    The s-maxage value, as an integer (seconds), or -1 if undefined.

### getNoCache

    public java.lang.String[] getNoCache()

  Get the `no-cache` directive of the cache control header.
  Returns:
    A list of token (potentially empty) encoded as an array of String (with 0 length if empty), or null if undefined.

### setNoCache

    public void setNoCache(java.lang.String[] nocache)

  Set the `no-cache` directive of the cache control header.
  Parameters:
    `nocache` - A list of headers name encoded as an array of String (of length possibly 0), or null to reset the value.

### setNoCache

    public void setNoCache()

  Set the `no-cache` directive globally.

### addNoCache

    public void addNoCache(java.lang.String name)

  Add the given header name to the `no-cache` directive.
  Parameters:
    `name` - The header name to add there.

### checkNoStore

    public boolean checkNoStore()

  Check the `no-store` directive of the cache control header.
  Returns:
    A boolean true if set, false otherwise.

### setNoStore

    public void setNoStore(boolean onoff)

  Set the `no-store` directive.
  Parameters:
    `onoff` - Turn it on or off.

### checkOnlyIfCached

    public boolean checkOnlyIfCached()

  Check the `only-if-cached` directive.
  Returns:
    A boolean, true if the directive is set, false otherwise.

### setOnlyIfCached

    public void setOnlyIfCached(boolean onoff)

  Set the `only-if-cached` directive.
  Parameters:
    `onoff` - Turn it on or off.

### setConnection

    public void setConnection(java.lang.String[] tokens)

  Header accessor - set the connection header value.
  Parameters:
    `tokens` - The connection tokens as a String array, or null to reset the value.

### getConnection

    public java.lang.String[] getConnection()

  Header accessor - get the connection header value.
  Returns:
    The tokens of the connection header, as a String array, or null if undefined.

### addConnection

    public void addConnection(java.lang.String name)

  Add the given header name to the `Connection` header.
  Parameters:
    `name` - The name of the header to add to the `Connection` header.

### hasConnection

    public boolean hasConnection(java.lang.String tok)

  Does the connection header include the given token ?
  Returns:
    A boolean.

### setProxyConnection

    public void setProxyConnection(java.lang.String[] tokens)

  Header accessor - set the proxy connection header value.
  Parameters:
    `tokens` - The connection tokens as a String array, or null to reset the value.

### addProxyConnection

    public void addProxyConnection(java.lang.String name)

  Add the given header name to the `Proxy-Connection` header.
  Parameters:
    `name` - The name of the header to add to the `Proxy-Connection` header.

### getProxyConnection

    public java.lang.String[] getProxyConnection()

  Header accessor - get the proxy connection header value.
  Returns:
    The tokens of the connection header, as a String array, or null if undefined.

### hasProxyConnection

    public boolean hasProxyConnection(java.lang.String tok)

  Does the proxy connection header defines the given token.
  Parameters:
    `tok` - The token to check for.
  Returns:
    A boolean.

### setDate

    public void setDate(long date)

  Header accessor - set the date of this message.
  Parameters:
    `date` - The date of the message, following Java runtime conventions (number of milliseconds since epoch), or -1 to reset the value.

### getDate

    public long getDate()

  Header accessor - get the date of this message.
  Returns:
    A long giving the date of this message, following the Java runtime convention (milliseconds since epoch), or -1 if undefined.

### setPragma

    public void setPragma(java.lang.String[] tokens)

  Header accessor - set the pragmas applicable to this message.
  Parameters:
    `tokens` - The pragma tokens as a String array, or null to reset the value.

### getPragma

    public java.lang.String[] getPragma()

  Header accessor - get the pragmas applicable to this message.
  Returns:
    The pragma tokens applicable to this message, encoded as a String array, or null if undefined.

### hasPragma

    public boolean hasPragma(java.lang.String pragma)

  Header accessor - Check for a given pragma.
  Parameters:
    `pragma` - The pragma to check for.
  Returns:
    A boolean true if this pragma is set, false otherwise.

### addPragma

    public void addPragma(java.lang.String name)

  Add the given directive to the `Pragma` header.
  Parameters:
    `name` - The name of the directive to add to the `Pragma` header.

### setTransferEncoding

    public void setTransferEncoding(java.lang.String[] tokens)

  Header accessor - set the transfer encoding for this message. This just sets the transfer encoding, it is up to the rest of the application to make sure that the encoding is actually applied at emiting time.
  Parameters:
    `tokens` - The transfer encoding tokens as a String array, or null to reset the value.

### addTransferEncoding

    public void addTransferEncoding(java.lang.String name)

  Add an encoding token to the given reply stream (ie the body).
  Parameters:
    `name` - The name of the encoding to add.

### getTransferEncoding

    public java.lang.String[] getTransferEncoding()

  Header accessor - get the transfer encoding applying to this message.
  Returns:
    The list of encoding tokens, as a String array, or null if undefined.

### hasTransferEncoding

    public boolean hasTransferEncoding(java.lang.String encoding)

  Header accessor - Check for a given transfer encoding.
  Parameters:
    `encoding` - The pragma to check for.
  Returns:
    A boolean true if this encoding is set, false otherwise.

### setUpgrade

    public void setUpgrade(java.lang.String[] products)

  Header accessor - set the upgrade header of this message.
  Parameters:
    `products` - An array of products you want this message to carry or null to reset the value.

### getUpgrade

    public java.lang.String[] getUpgrade()

  Header accessor - get the upgrade header of this message.
  Returns:
    A list of products, encoded as an array of String or null if undefined.

### setVia

    public void setVia(java.lang.String[] vias)

  Header accessor - set the Via header of this message.
  Parameters:
    `vias` - The hops to be placed in the `Via` header, or null to reset the value.

### getVia

    public java.lang.String[] getVia()

  Header accessor - get the via header of this message.
  Returns:
    A Via array describing each hop of the message, or null if undefined.

### addVia

    public void addVia(java.lang.String via)

  Add a via clause to the via header.
  Parameters:
    `via` - The new via clause.

### getProtocol

    public HttpBag getProtocol()

  Get the set of protocol extensions that have been applied to that that message.
  Returns:
    A bag containing the description of the protocol extensions applied to that message, or null.

### setProtocol

    public void setProtocol(HttpBag bag)

  Set the protocol extensions applied to that message.
  Parameters:
    `protocols` - A bag instance, describing the protocol extensions applied to the message, or null to reset previous value.

### getProtocolRequest

    public HttpBag getProtocolRequest()

  Get the set of protocol extensions requested by this message.
  Returns:
    A bag containing the description of the protocol extensions requested by this message, or null.

### setProtocolRequest

    public void setProtocolRequest(HttpBag bag)

  Set the protocol extensions required by this message.
  Parameters:
    `protocols` - A bag instance, describing the protocol extensions required by the message, or null to reset previous value.

### getProtocolInfo

    public HttpBag getProtocolInfo()

  Get the protocol extensions informations carried by this message.
  Returns:
    A bag containing the description of the protocol extensions informations carried by that message, or null.

### setProtocolInfo

    public void setProtocolInfo(HttpBag bag)

  Attach protocol extensions informations to that message.
  Parameters:
    `protocols` - A bag instance, describing the protocol extensions informations to attach to the message, or null to reset previous value.

### getProtocolQuery

    public HttpBag getProtocolQuery()

  Get the set of protocol extensions that are queried through this message.
  Returns:
    A bag containing the description of the protocol extensions queried by that message, or null.

### setProtocolQuery

    public void setProtocolQuery(HttpBag bag)

  Set the protocol extensions queried by that message.
  Parameters:
    `protocols` - A bag instance, describing the protocol extensions queried by the message, or null to reset previous value.

### getTrailer

    public java.lang.String[] getTrailer()

  Get this message trailer
  Returns:
    A list of encoding tokens, encoded as a String array, or null if undefined.

### setTrailer

    public void setTrailer(java.lang.String[] trailers)

  Set this message trailer
  Parameters:
    `encodings` - A list of encoding tokens, encoded as a String array or null to reset the value.

### getSetCookie

    public HttpSetCookieList getSetCookie()

  Get the value of the SetCookie header.
  Returns:
    AN HttpSetCookie instance, or null if undefined.

### setSetCookie

    public void setSetCookie(HttpSetCookieList setcookie)

  Set the value of the Set-Cookie header.
  Parameters:
    `setcookies` - The HttpSetCookie value.

### getCookie

    public HttpCookieList getCookie()

  Get the cookies attached to that message.
  Returns:
    An instance of HttpCookie holding the list of available cookies, or null if undefined.

### setCookie

    public void setCookie(HttpCookieList cookie)

  Set the cookies attached to this message.
  Parameters:
    `cookies` - The HttpCookie instance describing the cookies, or null to reset value.

### getVersion

    public java.lang.String getVersion()

  Get the String identifying the HTTP version used for this message.
  Returns:
    A String identifying the protocol version.

### getMajorVersion

    public short getMajorVersion()

  Get the major version number of this message. This method returns the major version that the caller should use to drive message processing. It may not match the version number actually emitted on the wire, which is computed by the API itself.
  Returns:
    A ninteger giving the major version number.

### getMinorVersion

    public short getMinorVersion()

  Get the minor version number of this message. This method returns the minor version that the caller should use to drive message processing. It may not match the minor version number emitted on the wire, which is computed by the API itself.
  Returns:
    An integer giving the minor version number.

### getEmitDate

    public long getEmitDate()

  Get the date at which this message was last emitted, if ever it was.
  Returns:
    The date, in milliseconds since Java epoch at which this message was emitted, or -1 if the message was never emitted.

### getExtList

    public HttpExtList getExtList(java.lang.String id)

  Get an Http Extension Listfrom the following list:
  - Mandatory (End-to-End) Extensions
  - Mandatory (Hop-by-Hop) Extensions
  - Optionnal (End-to-End) Extensions
  - Optionnal (hop-by-Hop) Extensions
  Parameters:
    `ext` - the Extension id
  Returns:
    a HttpExtList containing the extension declaration (or null)

### getExtHeader

    public java.lang.String getExtHeader(java.lang.String ext,
                                         java.lang.String header)

  get the String value of the given header relative to the given Extension. This method search the header in the following declarations:
  - Mandatory (End-to-End) Extensions
  - Mandatory (Hop-by-Hop) Extensions
  - Optionnal (End-to-End) Extensions
  - Optionnal (hop-by-Hop) Extensions
  Parameters:
    `ext` - the extension
    `header` - the extension header
  Returns:
    a String (or null)

### getManExtHeader

    public java.lang.String getManExtHeader(java.lang.String ext,
                                            java.lang.String header)

  get the String value of the given header relative to the given Extension. This method search the header in the following declarations:
  - Mandatory (End-to-End) Extensions
  Parameters:
    `ext` - the extension
    `header` - the extension header
  Returns:
    a String (or null)

### getOptExtHeader

    public java.lang.String getOptExtHeader(java.lang.String ext,
                                            java.lang.String header)

  get the String value of the given header relative to the given Extension. This method search the header in the following declarations:
  - Optionnal (End-to-End) Extensions
  Parameters:
    `ext` - the extension
    `header` - the extension header
  Returns:
    a String (or null)

### getCManExtHeader

    public java.lang.String getCManExtHeader(java.lang.String ext,
                                             java.lang.String header)

  get the String value of the given header relative to the given Extension. This method search the header in the following declarations:
  - Mandatory (Hop-by-Hop) Extensions
  Parameters:
    `ext` - the extension
    `header` - the extension header
  Returns:
    a String (or null)

### getCOptExtHeader

    public java.lang.String getCOptExtHeader(java.lang.String ext,
                                             java.lang.String header)

  get the String value of the given header relative to the given Extension. This method search the header in the following declarations:
  - Optionnal (hop-by-Hop) Extensions
  Parameters:
    `ext` - the extension
    `header` - the extension header
  Returns:
    a String (or null)

### getHttpManExtDecl

    public HttpExtList getHttpManExtDecl()

  Get The Mandatory (End-to-End) Extension declaration list.
  Returns:
    a HttpExtList instance or null;

### setHttpManExtDecl

    public void setHttpManExtDecl(HttpExtList exts)

  Set The Mandatory (End-to-End) Extension declaration list.
  Parameters:
    `exts` - the extension declaration list.

### getHttpCManExtDecl

    public HttpExtList getHttpCManExtDecl()

  Get The Mandatory (Hop-by-Hop) Extension declaration list.
  Returns:
    a HttpExtList instance or null;

### setHttpExtDecl

    public void setHttpExtDecl(HttpExtList exts)

  Set the Extension declaration. WARNING: The ManOpt flag of exts must have been set.
  Parameters:
    `exts` - the extension declaration list.

### setHttpCManExtDecl

    public void setHttpCManExtDecl(HttpExtList exts)

  Set The Mandatory (Hop-by-Hop) Extension declaration list.
  Parameters:
    `exts` - the extension declaration list.

### getHttpOptExtDecl

    public HttpExtList getHttpOptExtDecl()

  Get The Optionnal (End-to-End) Extension declaration list.
  Returns:
    a HttpExtList instance or null;

### setHttpOptExtDecl

    public void setHttpOptExtDecl(HttpExtList exts)

  Set The Optional (End-to-End) Extension declaration list.
  Parameters:
    `exts` - the extension declaration list.

### getHttpCOptExtDecl

    public HttpExtList getHttpCOptExtDecl()

  Get The Optionnal (Hop-by-Hop) Extension declaration list.
  Returns:
    a HttpExtList instance or null;

### setHttpCOptExtDecl

    public void setHttpCOptExtDecl(HttpExtList exts)

  Set The Optional (Hop-by-Hop) Extension declaration list.
  Parameters:
    `exts` - the extension declaration list.

### setNamespaces

    protected void setNamespaces(HttpExtList extl)

### getExtensionHeaders

    public java.util.Dictionary getExtensionHeaders(HttpExt ext)

  Get the headers relative to the given Http Extension declaration.
  Parameters:
    `ext` - the HttpExt
  Returns:
    a Dictionnary of <String, HeaderValue>

### setExtensionHeader

    public void setExtensionHeader(HttpExt ext,
                                   java.lang.String name,
                                   java.lang.String value)

  Set an extension header relative to the given extension declaration.
  Parameters:
    `ext` - The extension declaration
    `name` - the header name
    `value` - the header value

### generateExtNamespace

    protected java.lang.String generateExtNamespace()

  get a new namespace.
  Returns:
    an int.

### setEnd2EndExtensionAcknowledgmentHeader

    public void setEnd2EndExtensionAcknowledgmentHeader()

### setHopByHopExtensionAcknowledgmentHeader

    public void setHopByHopExtensionAcknowledgmentHeader()

### registerExtHeader

    public static final void registerExtHeader(java.lang.String name,
                                               java.lang.String cls)