## org.w3c.www.http
Class HttpRequestMessage

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

Direct Known Subclasses:
  Request, Request

public class HttpRequestMessage
extends HttpEntityMessage

Field Summary
`static int` `H_ACCEPT`
`static int` `H_ACCEPT_CHARSET`
`static int` `H_ACCEPT_ENCODING`
`static int` `H_ACCEPT_LANGUAGE`
`static int` `H_AUTHORIZATION`
`static int` `H_EXPECT`
`static int` `H_FROM`
`static int` `H_HOST`
`static int` `H_IF_MATCH`
`static int` `H_IF_MODIFIED_SINCE`
`static int` `H_IF_NONE_MATCH`
`static int` `H_IF_RANGE`
`static int` `H_IF_UNMODIFIED_SINCE`
`static int` `H_MAX_FORWARDS`
`static int` `H_PROXY_AUTHORIZATION`
`static int` `H_RANGE`
`static int` `H_REFERER`
`static int` `H_TE`
`static int` `H_USER_AGENT`
`protected java.lang.String` `method` The method to execute on the target resource.
`protected java.net.URL` `proxy` The proxy to use for that request, if any.
`protected java.lang.String` `sProxy`
`protected java.net.URL` `url` The target resource, identified by its URL.

Fields inherited from class org.w3c.www.http.HttpEntityMessage
`H_ALLOW, H_CONTENT_BASE, H_CONTENT_ENCODING, H_CONTENT_LANGUAGE, H_CONTENT_LENGTH, H_CONTENT_LOCATION, H_CONTENT_MD5, H_CONTENT_RANGE, H_CONTENT_TYPE, H_ETAG, H_EXPIRES, H_LAST_MODIFIED`

Fields inherited from class org.w3c.www.http.HttpMessage
`descriptors, EMIT_ALL, EMIT_BODY, EMIT_FOOTERS, EMIT_HEADERS, emitdate, factory, H_CACHE_CONTROL, H_CMAN_EXT, H_CONNECTION, H_COOKIE, H_COPT_EXT, H_DATE, H_MAN_EXT, H_OPT_EXT, H_PRAGMA, H_PROTOCOL, H_PROTOCOL_INFO, H_PROTOCOL_QUERY, H_PROTOCOL_REQUEST, H_PROXY_CONNECTION, H_SET_COOKIE, H_TRAILER, H_TRANSFER_ENCODING, H_UPGRADE, H_VIA, headers, major, MAX_HEADERS, minor, state, values`

Constructor Summary
`HttpRequestMessage()`
`HttpRequestMessage(MimeParser parser)`

Method Summary
`void` `dump(java.io.OutputStream out)`
`HttpAccept[]` `getAccept()` Get this request accept list.
`HttpAcceptCharset[]` `getAcceptCharset()` Get the list of accepted charsets for this request.
`HttpAcceptEncoding[]` `getAcceptEncoding()` Get the list of accepted encodings.
`HttpAcceptLanguage[]` `getAcceptLanguage()` Get the list of accepted languages for this request.
`HttpCredential` `getAuthorization()` Get the authorization associated with this request.
`java.lang.String` `getExpect()` Get this request's Expect header value.
`java.lang.String` `getFrom()` Get the originator (from header value) of the request.
`java.lang.String` `getHost()` Get the host header.
`HttpEntityTag[]` `getIfMatch()` Get the conditional matching set of entity tags.
`long` `getIfModifiedSince()` Get the if-modified-since conditional.
`HttpEntityTag[]` `getIfNoneMatch()` Get the conditional none matching entity tags.
`HttpEntityTag` `getIfRange()` Get the if-range conditional if any.
`long` `getIfUnmodifiedSince()` Get the if unmodified since conditional date.
`int` `getMaxForwards()` Get the maximum allowed count of hops for the request.
`int` `getMaxStale()` Get the `max-stale` directive value of the cache control header.
`java.lang.String` `getMethod()` Get this request's method.
`int` `getMinFresh()` Get the `min-fresh` directive value of the cache control header.
`java.net.URL` `getProxy()` Get the proxy to use for that request.
`HttpCredential` `getProxyAuthorization()` Get the authorization associated with this request.
`HttpRange[]` `getRange()` Get the ranges queried by this request.
`java.lang.String` `getReferer()` Get the referer of the request.
`protected java.lang.String` `getTarget()`
`HttpAcceptEncoding[]` `getTE()` Get the list of restricted transfer encodings.
`java.net.URL` `getURL()` Get this request's target URI.
`java.lang.String` `getUserAgent()` Get the user agent String.
`boolean` `hasAuthorization()` Does this request has some specific authorization infos.
`boolean` `hasProxy()` Will this request use a proxy when executed ?
`static void` `main(java.lang.String[] args)`
`boolean` `notifyBeginParsing(MimeParser parser)` MimeHeaderHolder implementation - HTTP message about to be parsed.
`void` `notifyEndParsing(MimeParser parser)` All the headers have been parsed, take any appropriate actions.
`void` `setAccept(HttpAccept[] accepts)` Set the list of accept clauses attached to this request.
`void` `setAcceptCharset(HttpAcceptCharset[] charsets)` Set the list of accepted charsets for this request.
`void` `setAcceptEncoding(HttpAcceptEncoding[] encoding)` Set the list of accepted encodings.
`void` `setAcceptLanguage(HttpAcceptCharset[] langs)` Set the list of accepted languages for this request.
`void` `setAuthorization(HttpCredential credentials)` Set the authorization associated with this request.
`void` `setExpect(java.lang.String expect)` Set this request's Expect header.
`void` `setFrom(java.lang.String from)` Set the originator of this request.
`void` `setHost(java.lang.String host)` Set the host header value.
`void` `setIfMatch(HttpEntityTag[] etags)` Set the conditional matching set of entity tags.
`void` `setIfModifiedSince(long ims)` Set the if-modified-since conditional.
`void` `setIfNoneMatch(HttpEntityTag[] etags)` Set the conditional none matching entity tags.
`void` `setIfRange(HttpEntityTag etag)` Set the if-range header value.
`void` `setIfUnmodifiedSince(long date)` Set the if-unmodified-since conditional date.
`void` `setMaxForwards(int hops)` Set the maximum allowed count of hops for that request.
`void` `setMaxStale(int maxstale)` Set the `max-stale` directive value.
`void` `setMethod(java.lang.String method)` Set this request's method.
`void` `setMinFresh(int minfresh)` Set the `min-fresh` directive value of the cache control header.
`void` `setProxy(java.net.URL proxy)` Set the proxy to use for that request.
`void` `setProxyAuthorization(HttpCredential credentials)` Set the proxy authorization associated with that request.
`void` `setRange(HttpRange[] ranges)` Set the ranges queried by this request.
`void` `setReferer(java.lang.String referer)` Set the referer of this request.
`protected void` `setTarget(java.lang.String target)`
`void` `setTE(HttpAcceptEncoding[] encoding)` Set the list of restricted transfer encodings
`void` `setURL(java.net.URL url)` Set this request URI.
`void` `setUserAgent(java.lang.String ua)` Set the user agent description header.
`protected void` `startEmit(java.io.OutputStream out, int what)` This message is about to be emited, emit the request-line first !

Methods inherited from class org.w3c.www.http.HttpEntityMessage
`addContentEncoding, getAllow, getContentBase, getContentEncoding, getContentLanguage, getContentLength, getContentLocation, getContentMD5, getContentRange, getContentType, getETag, getExpires, getLastModified, hasContentRange, setAllow, setContentBase, setContentEncoding, setContentLanguage, setContentLength, setContentLocation, setContentMD5, setContentType, setETag, setExpires, setLastModified`

Methods inherited from class org.w3c.www.http.HttpMessage

`addConnection, addNoCache, addPragma, addProxyConnection, addTransferEncoding, addVia, checkNoStore, checkOnlyIfCached, delState, emit, emit, emitHeaders, endEmit, enumerateHeaderDescriptions, enumerateHeaderDescriptions, generateExtNamespace, getCacheControl, getClone, getCManExtHeader, getConnection, getCookie, getCOptExtHeader, getDate, getEmitDate, getExtensionHeaders, getExtHeader, getExtList, getHeaderValue, getHeaderValue, getHeaderValue, getHeaderValue, getHttpCManExtDecl, getHttpCOptExtDecl, getHttpManExtDecl, getHttpOptExtDecl, getMajorVersion, getManExtHeader, getMaxAge, getMinorVersion, getNoCache, getOptExtHeader, getPragma, getProtocol, getProtocolInfo, getProtocolQuery, getProtocolRequest, getProxyConnection, getSetCookie, getSMaxAge, getState, getStateNames, getTrailer, getTransferEncoding, getUpgrade, getValue, getValue, getVersion, getVia, hasConnection, hasHeader, hasHeader, hasPragma, hasProxyConnection, hasState, hasTransferEncoding, notifyHeader, registerExtHeader, registerHeader, registerHeader, removeHeader, removeHeader, setCacheControl, setConnection, setCookie, setDate, setEnd2EndExtensionAcknowledgmentHeader, setExtensionHeader, setHeaderValue, setHeaderValue, setHeaderValue, setHopByHopExtensionAcknowledgmentHeader, setHttpCManExtDecl, setHttpCOptExtDecl, setHttpExtDecl, setHttpManExtDecl, setHttpOptExtDecl, setMaxAge, setNamespaces, setNoCache, setNoCache, setNoStore, setOnlyIfCached, setPragma, setProtocol, setProtocolInfo, setProtocolQuery, setProtocolRequest, setProxyConnection, setSetCookie, setSMaxAge, setState, setTrailer, setTransferEncoding, setUpgrade, setValue, setVia`

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

Field Detail

### H_ACCEPT

    public static int H_ACCEPT

### H_ACCEPT_CHARSET

    public static int H_ACCEPT_CHARSET

### H_ACCEPT_ENCODING

    public static int H_ACCEPT_ENCODING

### H_ACCEPT_LANGUAGE

    public static int H_ACCEPT_LANGUAGE

### H_AUTHORIZATION

    public static int H_AUTHORIZATION

### H_EXPECT

    public static int H_EXPECT

### H_FROM

    public static int H_FROM

### H_HOST

    public static int H_HOST

### H_IF_MODIFIED_SINCE

    public static int H_IF_MODIFIED_SINCE

### H_IF_MATCH

    public static int H_IF_MATCH

### H_IF_NONE_MATCH

    public static int H_IF_NONE_MATCH

### H_IF_RANGE

    public static int H_IF_RANGE

### H_IF_UNMODIFIED_SINCE

    public static int H_IF_UNMODIFIED_SINCE

### H_MAX_FORWARDS

    public static int H_MAX_FORWARDS

### H_PROXY_AUTHORIZATION

    public static int H_PROXY_AUTHORIZATION

### H_RANGE

    public static int H_RANGE

### H_REFERER

    public static int H_REFERER

### H_TE

    public static int H_TE

### H_USER_AGENT

    public static int H_USER_AGENT

### method

    protected java.lang.String method

  The method to execute on the target resource.

### url

    protected java.net.URL url

  The target resource, identified by its URL.

### proxy

    protected java.net.URL proxy

  The proxy to use for that request, if any.

### sProxy

    protected java.lang.String sProxy

Constructor Detail

### HttpRequestMessage

    public HttpRequestMessage(MimeParser parser)

### HttpRequestMessage

    public HttpRequestMessage()

Method Detail

### startEmit

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

  This message is about to be emited, emit the request-line first !
  Overrides:
    startEmit in class HttpMessage
  Parameters:
    `out` - The output stream to emit the request to.
  Throws:
    java.io.IOException - If some IO error occured while emiting the request.

### dump

    public void dump(java.io.OutputStream out)

  Overrides:
    dump in class HttpMessage

### notifyBeginParsing

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

  Description copied from class: HttpMessage
  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.
  Overrides:
    notifyBeginParsing in class HttpMessage
  Returns:
    A boolean true if the MIME parser should stop parsing, false otherwise.
  Throws:
    java.io.IOException - If some IO error occured while reading the stream.
    HttpParserException - if parsing failed.

### notifyEndParsing

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

  All the headers have been parsed, take any appropriate actions. Here we will verify that the request is HTTP/1.1 compliant for the Host header.
  Overrides:
    notifyEndParsing in class HttpMessage
  Parameters:
    `parser` - The Mime parser.
  Throws:
    MimeParserException - if the parsing failed
    java.io.IOException - if an IO error occurs.

### setTarget

    protected void setTarget(java.lang.String target)

### getTarget

    protected java.lang.String getTarget()

### getMethod

    public java.lang.String getMethod()

  Get this request's method.
  Returns:
    The request method, as a String.

### setMethod

    public void setMethod(java.lang.String method)

  Set this request's method.
  Parameters:
    `mth` - The request method.

### getURL

    public java.net.URL getURL()

  Get this request's target URI. This will only return the absolute path of the requested resource, even if the actual request came with the full path as an URI.
  Returns:
    An URL instance, or null if undefined.

### setURL

    public void setURL(java.net.URL url)

  Set this request URI. The provided URI should only include the absolute path of the target request, see the `setHost` method for how to set the actual host of the target resource.
  Parameters:
    `url` - The target URL of the request, as an URL instance.

### getMinFresh

    public int getMinFresh()

  Get the `min-fresh` directive value of the cache control header.
  Returns:
    The min-fresh value, as a number of seconds, or -1 if undefined.

### setMinFresh

    public void setMinFresh(int minfresh)

  Set the `min-fresh` directive value of the cache control header.
  Parameters:
    `minfresh` - The min-fresh value, in seconds, or -1 to reset value.

### getMaxStale

    public int getMaxStale()

  Get the `max-stale` directive value of the cache control header.
  Returns:
    The max-stale value, as a number of seconds, or -1 if undefined.

### setMaxStale

    public void setMaxStale(int maxstale)

  Set the `max-stale` directive value.
  Parameters:
    `maxstale` - A number of seconds giving the allowed drift for a resource that is no more valid, or -1 to reset the value.

### getAccept

    public HttpAccept[] getAccept()

  Get this request accept list.
  Returns:
    A list of Accept clauses encoded as an array of HttpAccept instances, or null if undefined.

### setAccept

    public void setAccept(HttpAccept[] accepts)

  Set the list of accept clauses attached to this request.
  Parameters:
    `accepts` - The list of accept clauses encoded as an array of HttpAccept instances, or null to reset the value.

### getAcceptCharset

    public HttpAcceptCharset[] getAcceptCharset()

  Get the list of accepted charsets for this request.
  Returns:
    The list of accepted languages encoded as an array of instances of HttpAcceptCharset, or null if undefined.

### setAcceptCharset

    public void setAcceptCharset(HttpAcceptCharset[] charsets)

  Set the list of accepted charsets for this request.
  Parameters:
    `charsets` - The list of accepted charsets, encoded as an array of HttpAcceptCharset instances, or null to reset the value.

### getAcceptEncoding

    public HttpAcceptEncoding[] getAcceptEncoding()

  Get the list of accepted encodings.
  Returns:
    A list of token describing the accepted encodings, or null if undefined.

### setAcceptEncoding

    public void setAcceptEncoding(HttpAcceptEncoding[] encoding)

  Set the list of accepted encodings.
  Parameters:
    `encodings` - The list of accepted encodings, as an array, of HttpAcceptEncoding or null to reset the value.

### getAcceptLanguage

    public HttpAcceptLanguage[] getAcceptLanguage()

  Get the list of accepted languages for this request.
  Returns:
    The list of accepted languages encoded as an array of instances of HttpAcceptLanguage, or null if undefined.

### setAcceptLanguage

    public void setAcceptLanguage(HttpAcceptCharset[] langs)

  Set the list of accepted languages for this request.
  Parameters:
    `langs` - The list of accepted languages, encoded as an array of HttpAcceptLanguage instances, or null to reset value.

### getAuthorization

    public HttpCredential getAuthorization()

  Get the authorization associated with this request.
  Returns:
    An instance of HttpCredential of null if undefined.

### setAuthorization

    public void setAuthorization(HttpCredential credentials)

  Set the authorization associated with this request.
  Parameters:
    `credentials` - The credentials to attach to this request, or null to reset the value.

### hasAuthorization

    public boolean hasAuthorization()

  Does this request has some specific authorization infos.
  Returns:
    A boolean.

### getFrom

    public java.lang.String getFrom()

  Get the originator (from header value) of the request.
  Returns:
    The originator description, as a String, or null if undefined.

### setFrom

    public void setFrom(java.lang.String from)

  Set the originator of this request.
  Parameters:
    `from` - The description of the originator, as an email address, or null to reset the value.

### getHost

    public java.lang.String getHost()

  Get the host header.
  Returns:
    The host header, encoded as a String, or null if undefined.

### setHost

    public void setHost(java.lang.String host)

  Set the host header value.
  Parameters:
    `host` - The String representing the target host of the request, or null to reset the value.

### getIfModifiedSince

    public long getIfModifiedSince()

  Get the if-modified-since conditional.
  Returns:
    A long, giving the If-Modified-Since date value as the number of milliseconds since Java epoch, or -1 if undefined.

### setIfModifiedSince

    public void setIfModifiedSince(long ims)

  Set the if-modified-since conditional.
  Parameters:
    `ims` - The date of last modification, as the number of milliseconds since Java epoch, or -1 to reset the value.

### getIfMatch

    public HttpEntityTag[] getIfMatch()

  Get the conditional matching set of entity tags.
  Returns:
    An array of HttpEntityTag instances, or null if undefined.

### setIfMatch

    public void setIfMatch(HttpEntityTag[] etags)

  Set the conditional matching set of entity tags.
  Parameters:
    `etags` - An array of HttpEntityTag, one per item in the set, or null to reset the header value.

### getIfNoneMatch

    public HttpEntityTag[] getIfNoneMatch()

  Get the conditional none matching entity tags.
  Returns:
    An entity tag list, encoded as an array of HttpEntityTag, or null if undefined.

### setIfNoneMatch

    public void setIfNoneMatch(HttpEntityTag[] etags)

  Set the conditional none matching entity tags.
  Parameters:
    `etags` - An array of HttpEntityTag, one per item in the set, or null to reset the value.

### getIfRange

    public HttpEntityTag getIfRange()

  Get the if-range conditional if any. Warning: This API doesn't accept `If-Range` header that contains date value (if you want to discuss why, send me email)
  Returns:
    An HttpEntityTag instance, or null if that header is not defined.

### setIfRange

    public void setIfRange(HttpEntityTag etag)

  Set the if-range header value.
  Parameters:
    `etag` - The contional etag, or null to reset previous setting.

### getIfUnmodifiedSince

    public long getIfUnmodifiedSince()

  Get the if unmodified since conditional date.
  Returns:
    The date encoded as a long number of milliseconds since Java runtime epoch, or -1 if undefined.

### setIfUnmodifiedSince

    public void setIfUnmodifiedSince(long date)

  Set the if-unmodified-since conditional date.
  Parameters:
    `date` - The date, encoded as the number of milliseconds since Java epoch, or -1 to reset value.

### getMaxForwards

    public int getMaxForwards()

  Get the maximum allowed count of hops for the request.
  Returns:
    An integer giving the number of hops, or -1 if undefined.

### setMaxForwards

    public void setMaxForwards(int hops)

  Set the maximum allowed count of hops for that request.
  Parameters:
    `hops` - The hops count, or -1 to reset value.

### setProxyAuthorization

    public void setProxyAuthorization(HttpCredential credentials)

  Set the proxy authorization associated with that request.
  Parameters:
    `credentials` - The credentials, or null to reset the value.

### getProxyAuthorization

    public HttpCredential getProxyAuthorization()

  Get the authorization associated with this request.
  Returns:
    An instance of HttpCredential of null if undefined.

### getRange

    public HttpRange[] getRange()

  Get the ranges queried by this request.
  Returns:
    A list of ranges, encoded as an array of HttpRange instance or null if undefined.

### setRange

    public void setRange(HttpRange[] ranges)

  Set the ranges queried by this request.
  Parameters:
    `ranges` - The list of ranges, encoded as an array of instances of HttpRange, or null to reset the value.

### getReferer

    public java.lang.String getReferer()

  Get the referer of the request.
  Returns:
    A String encoding the referer (generally an URL), or null if undefined.

### setReferer

    public void setReferer(java.lang.String referer)

  Set the referer of this request.
  Parameters:
    `referer` - The referer of the request, or null to reset the value.

### getUserAgent

    public java.lang.String getUserAgent()

  Get the user agent String.
  Returns:
    The user agent description, as a String, or null if undefined.

### setUserAgent

    public void setUserAgent(java.lang.String ua)

  Set the user agent description header.
  Parameters:
    `ua` - The description of the user agent emiting the request, or null to reset the value.

### getExpect

    public java.lang.String getExpect()

  Get this request's Expect header value.
  Returns:
    This header as a String.

### setExpect

    public void setExpect(java.lang.String expect)

  Set this request's Expect header.
  Parameters:
    `exp` - The value of the header (ex: "100-continue".

### getTE

    public HttpAcceptEncoding[] getTE()

  Get the list of restricted transfer encodings.
  Returns:
    A list of token describing the restreicted TE, or null if undefined.

### setTE

    public void setTE(HttpAcceptEncoding[] encoding)

  Set the list of restricted transfer encodings
  Parameters:
    `encodings` - The list of accepted encodings, as an array, of HttpAcceptEncoding or null to reset the value.

### setProxy

    public void setProxy(java.net.URL proxy)

  Set the proxy to use for that request.
  Parameters:
    `proxy` - The proxy's URL, or null to reset value.

### getProxy

    public java.net.URL getProxy()

  Get the proxy to use for that request.
  Returns:
    The proxy's URL, or null if none is set.

### hasProxy

    public boolean hasProxy()

  Will this request use a proxy when executed ?
  Returns:
    A boolean.

### main

    public static void main(java.lang.String[] args)