|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
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
|
static java.lang.String |
ORIG_URL_STATE
the state of original URL |
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()
Get the URL path of the target resource. |
boolean |
hasAccept()
|
boolean |
hasAcceptCharset()
|
boolean |
hasAcceptEncoding()
|
boolean |
hasAcceptLanguage()
|
boolean |
hasAuthorization()
Does this request has some specific authorization infos. |
boolean |
hasContentLength()
|
boolean |
hasContentType()
|
boolean |
hasProxyAuthorization()
|
boolean |
hasQueryString()
|
boolean |
isInternal()
Return true is the request is internal. |
boolean |
isProxy()
|
ReplyInterface |
makeBadRequestReply()
Get a "Bad request" reply. |
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)
FIXME doc |
void |
setStream(java.io.InputStream is)
Set this reply entity body. |
protected void |
setTargetResource(ResourceReference resource)
|
void |
setURLPath(java.lang.String path)
|
void |
skipBody()
skip the body |
static java.lang.String |
unescape(java.lang.String s)
Unescape a HTTP escaped string |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.net.URL THE_SERVER
OPTIONS
method.
public static final java.lang.String ORIG_URL_STATE
protected Client client
protected MimeParser parser
protected java.io.InputStream in
protected boolean keepcon
protected boolean internal
protected Request original
protected ResourceFilter[] filters
protected int infilters
Constructor Detail |
---|
public Request(Client client, MimeParser parser)
Method Detail |
---|
public void setState(java.lang.String name, java.lang.String state)
RequestInterface
setState
in interface RequestInterface
public void notifyEndParsing(MimeParser parser) throws HttpParserException, java.io.IOException
notifyEndParsing
in interface MimeHeaderHolder
notifyEndParsing
in class HttpRequestMessage
parser
- The MimeParser
HttpParserException
- if parsing failed.
java.io.IOException
- if an IO error occurs.public boolean canKeepConnection()
protected void setTargetResource(ResourceReference resource)
public ResourceReference getTargetResource()
public void setProxy(boolean onoff)
public boolean isProxy()
public java.lang.String getURLPath()
RequestInterface
getURLPath
in interface RequestInterface
public void setURLPath(java.lang.String path)
public boolean hasContentLength()
public boolean hasContentType()
public boolean hasAccept()
public boolean hasAcceptCharset()
public boolean hasAcceptEncoding()
public boolean hasAcceptLanguage()
public boolean hasAuthorization()
HttpRequestMessage
hasAuthorization
in class HttpRequestMessage
public boolean hasProxyAuthorization()
public java.lang.String getQueryString()
public boolean hasQueryString()
public boolean isInternal()
RequestInterface
isInternal
in interface RequestInterface
public void setInternal(boolean onoff)
public Request getOriginal()
protected void setFilters(ResourceFilter[] filters, int infilters)
public HttpMessage getClone()
The original request and its clone differ in the following way:
isInternal
method.
getOriginal
method.
To run an internal request, the caller can then use the
org.w3c.jigsaw.http.httpd
perform
method.
getClone
in class HttpMessage
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public static java.lang.String unescape(java.lang.String s)
s
- The string to be unescaped
public ReplyInterface makeBadRequestReply()
RequestInterface
makeBadRequestReply
in interface RequestInterface
public Reply makeReply(int status)
status
- The status of the reply.public void skipBody()
public Client getClient()
public void setStream(java.io.InputStream is)
is
- the InputStream instance.
USE CAREFULLY : need to be thread-safe
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |