## org.w3c.jigsaw.http
Class Request

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

public class Request
extends HttpRequestMessage
implements HTTP, RequestInterface

this class extends HttpRequestMessage to cope with HTTP request. One subtely here: note how each field acessor never throws an exception, but rather is provided with a default value: this is in the hope that sometime, HTTP will not require all the parsing it requires right now.

Field Summary
`protected Client` | `client`
`protected ResourceFilter[]` | `filters`
`protected java.io.InputStream` | `in`
`protected int` | `infilters`
`protected boolean` | `internal`
`protected boolean` | `keepcon`
`protected Request` | `original`
`protected MimeParser` | `parser`
`static java.net.URL` | `THE_SERVER` The URL that means * for an `OPTIONS` method.

Fields inherited from class org.w3c.www.http.HttpRequestMessage
`H_ACCEPT, H_ACCEPT_CHARSET, H_ACCEPT_ENCODING, H_ACCEPT_LANGUAGE, H_AUTHORIZATION, H_EXPECT, H_FROM, H_HOST, H_IF_MATCH, H_IF_MODIFIED_SINCE, H_IF_NONE_MATCH, H_IF_RANGE, H_IF_UNMODIFIED_SINCE, H_MAX_FORWARDS, H_PROXY_AUTHORIZATION, H_RANGE, H_REFERER, H_TE, H_USER_AGENT, method, proxy, sProxy, 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
`Request(Client client, MimeParser parser)`

Method Summary
`boolean` | `canKeepConnection()`
`Client` | `getClient()` Get the client of this request.
`HttpMessage` | `getClone()` Clone this request, in order to launch an internal request.
`java.io.InputStream` | `getInputStream()` Get this reply entity body.
`Request` | `getOriginal()`
`java.lang.String` | `getQueryString()`
`ResourceReference` | `getTargetResource()` Get this request target resource.
`java.lang.String` | `getURLPath()`
`boolean` | `hasAccept()`
`boolean` | `hasAcceptCharset()`
`boolean` | `hasAcceptEncoding()`
`boolean` | `hasAcceptLanguage()`
`boolean` | `hasAuthorization()`
`boolean` | `hasContentLength()`
`boolean` | `hasContentType()`
`boolean` | `hasProxyAuthorization()`
`boolean` | `hasQueryString()`
`boolean` | `isInternal()`
`boolean` | `isProxy()`
`ReplyInterface` | `makeBadRequestReply()`
`Reply` | `makeReply(int status)` Make an empty Reply object matching this request version.
`void` | `notifyEndParsing(MimeParser parser)` Fix the target URL of the request, this is the only good time to do so.
`protected void` | `setFilters(ResourceFilter[] filters, int infilters)`
`void` | `setInternal(boolean onoff)`
`void` | `setProxy(boolean onoff)`
`void` | `setState(java.lang.String name, java.lang.String state)`
`protected void` | `setTargetResource(ResourceReference resource)`
`void` | `setURLPath(java.lang.String path)`
`static java.lang.String` | `unescape(java.lang.String s)` Unescape a HTTP escaped string

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

`dump, getAccept, getAcceptCharset, getAcceptEncoding, getAcceptLanguage, getAuthorization, getExpect, getFrom, getHost, getIfMatch, getIfModifiedSince, getIfNoneMatch, getIfRange, getIfUnmodifiedSince, getMaxForwards, getMaxStale, getMethod, getMinFresh, getProxy, getProxyAuthorization, getRange, getReferer, getTarget, getTE, getURL, getUserAgent, hasProxy, main, notifyBeginParsing, setAccept, setAcceptCharset, setAcceptEncoding, setAcceptLanguage, setAuthorization, setExpect, setFrom, setHost, setIfMatch, setIfModifiedSince, setIfNoneMatch, setIfRange, setIfUnmodifiedSince, setMaxForwards, setMaxStale, setMethod, setMinFresh, setProxy, setProxyAuthorization, setRange, setReferer, setTarget, setTE, setURL, setUserAgent, startEmit`

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, getConnection, getCookie, getDate, getEmitDate, getExtensionHeaders, getHeaderValue, getHeaderValue, getHeaderValue, getHeaderValue, getHttpCManExtDecl, getHttpCOptExtDecl, getHttpManExtDecl, getHttpOptExtDecl, getMajorVersion, getMaxAge, getMinorVersion, getNoCache, getPragma, getProtocol, getProtocolInfo, getProtocolQuery, getProtocolRequest, getProxyConnection, getSetCookie, getState, getStateNames, getTrailer, getTransferEncoding, getUpgrade, getValue, getValue, getVersion, getVia, hasConnection, hasHeader, hasHeader, hasPragma, hasProxyConnection, hasState, hasTransferEncoding, notifyHeader, registerHeader, registerHeader, removeHeader, removeHeader, setCacheControl, setConnection, setCookie, setDate, setEnd2EndExtensionAcknowledgmentHeader, setExtensionHeader, setHeaderValue, setHeaderValue, setHeaderValue, setHopByHopExtensionAcknowledgmentHeader, setHttpCManExtDecl, setHttpCOptExtDecl, setHttpManExtDecl, setHttpOptExtDecl, setMaxAge, setNamespaces, setNoCache, setNoCache, setNoStore, setOnlyIfCached, setPragma, setProtocol, setProtocolInfo, setProtocolQuery, setProtocolRequest, setProxyConnection, setSetCookie, 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

### THE_SERVER

    public static java.net.URL THE_SERVER

  The URL that means * for an `OPTIONS` method.

### client

    protected Client client

### parser

    protected MimeParser parser

### in

    protected java.io.InputStream in

### keepcon

    protected boolean keepcon

### internal

    protected boolean internal

### original

    protected Request original

### filters

    protected ResourceFilter[] filters

### infilters

    protected int infilters

Constructor Detail

### Request

    public Request(Client client,
                   MimeParser parser)

Method Detail

### setState

    public void setState(java.lang.String name,
                         java.lang.String state)

  Specified by:
    setState in interface RequestInterface

### notifyEndParsing

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

  Fix the target URL of the request, this is the only good time to do so.
  Parameters:
    `parser` - The MimeParser
  Throws:
    HttpParserException - if parsing failed.
    java.io.IOException - if an IO error occurs.
  Overrides:
    notifyEndParsing in class HttpMessage

### canKeepConnection

    public boolean canKeepConnection()

### setTargetResource

    protected void setTargetResource(ResourceReference resource)

### getTargetResource

    public ResourceReference getTargetResource()

  Get this request target resource.
  Returns:
    An instance of HTTPResource, or null if not found.

### setProxy

    public void setProxy(boolean onoff)

### isProxy

    public boolean isProxy()

### getURLPath

    public java.lang.String getURLPath()

  Specified by:
    getURLPath in interface RequestInterface

### setURLPath

    public void setURLPath(java.lang.String path)

### hasContentLength

    public boolean hasContentLength()

### hasContentType

    public boolean hasContentType()

### hasAccept

    public boolean hasAccept()

### hasAcceptCharset

    public boolean hasAcceptCharset()

### hasAcceptEncoding

    public boolean hasAcceptEncoding()

### hasAcceptLanguage

    public boolean hasAcceptLanguage()

### hasAuthorization

    public boolean hasAuthorization()

  Overrides:
    hasAuthorization in class HttpRequestMessage

### hasProxyAuthorization

    public boolean hasProxyAuthorization()

### getQueryString

    public java.lang.String getQueryString()

### hasQueryString

    public boolean hasQueryString()

### isInternal

    public boolean isInternal()

  Specified by:
    isInternal in interface RequestInterface

### setInternal

    public void setInternal(boolean onoff)

### getOriginal

    public Request getOriginal()

### setFilters

    protected void setFilters(ResourceFilter[] filters,
                              int infilters)

### getClone

    public HttpMessage getClone()

  Clone this request, in order to launch an internal request. This method can be used to run a request in some given context, defined by an original request. It will preserve all the original information (such as authentication, etc), and will provide a clone of the original request.

  The original request and its clone differ in the following way:

  - The clone is marked as internal, which can be tested by the `isInternal` method.
  - The clone will keep a pointer to the first request that was cloned. This original request can be accessed by the `getOriginal` method.

  To run an internal request, the caller can then use the `org.w3c.jigsaw.http.httpd` `perform` method.

  Returns:
    A fresh Request instance, marked as internal.
  Overrides:
    getClone in class HttpMessage

### getInputStream

    public java.io.InputStream getInputStream()
                                       throws java.io.IOException

  Get this reply entity body. The reply entity body is returned as an InputStream, that the caller has to read to actually get the bytes of the content.
  Returns:
    An InputStream instance. If the reply has no body, the returned input stream will just return -1 on first read.

### unescape

    public static java.lang.String unescape(java.lang.String s)

  Unescape a HTTP escaped string
  Parameters:
    `s` - The string to be unescaped
  Returns:
    the unescaped string.

### makeBadRequestReply

    public ReplyInterface makeBadRequestReply()

  Specified by:
    makeBadRequestReply in interface RequestInterface

### makeReply

    public Reply makeReply(int status)

  Make an empty Reply object matching this request version.
  Parameters:
    `status` - The status of the reply.

### getClient

    public Client getClient()

  Get the client of this request.