org.w3c.www.protocol.http
Class Request

java.lang.Object
  extended by org.w3c.www.http.HttpMessage
      extended by org.w3c.www.http.HttpEntityMessage
          extended by org.w3c.www.http.HttpRequestMessage
              extended by org.w3c.www.protocol.http.Request
All Implemented Interfaces:
java.lang.Cloneable, HTTP, MimeHeaderHolder
Direct Known Subclasses:
DAVRequest

public class Request
extends HttpRequestMessage

The client side idea of a request. Requests are created only by the HttpManager, by cloning its template request that defines the default (application wide) request settings.


Field Summary
protected  boolean allowuserinteraction
          Are we allowed to interact with the user ?
protected  boolean interrupted
          Has this request been interrupted ?
protected  HttpManager manager
          The manager that created this request.
protected  RequestObserver observer
          The observer for the request, if any.
protected  java.io.InputStream output
          The request output stream, to PUT or POST data.
protected  boolean pipeline
          Can we pipeline that request, if appropriate support is detected ?
protected  HttpServer server
          The server currently running the request, if any.
 
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
 
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
protected Request(HttpManager manager)
           
 
Method Summary
protected  void endEmit(java.io.OutputStream out, int what)
          End of header emiting, continue by sending optional output stream.
 boolean getAllowUserInteraction()
          Are we allowed to do some user interaction to run this request.
 HttpManager getManager()
          Get this request's manager.
 RequestObserver getObserver()
          Get the observer for this request.
 java.io.InputStream getOutputStream()
          Get the input stream to read that request body.
 boolean hasOutputStream()
          Does this request has an associated input stream ?
 void interruptRequest()
          Interrupt that request processing.
 boolean isInterrupted()
          Has this request been interrupted ?
 Reply makeReply(int status)
          Create a Reply instance matching this request.
 void setAllowUserInteraction(boolean onoff)
          Decide wether we are allowed to interact wit hthe user.
 void setObserver(RequestObserver observer)
          Set the observer for this request.
 void setOutputStream(java.io.InputStream in)
          Set this request output stream.
 void setPipeline(boolean onoff)
          Enable/disable pipelining for that request.
protected  void setServer(HttpServer server)
          Mark that request has being run by given server.
protected  void unsetServer()
          Mark that request as no longer attached to a server object.
 
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, hasAuthorization, hasProxy, main, notifyBeginParsing, notifyEndParsing, 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, enumerateHeaderDescriptions, enumerateHeaderDescriptions, generateExtNamespace, getCacheControl, getClone, getCManExtHeader, getConnection, getCookie, getCOptExtHeader, getDate, getDeeperClone, 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

manager

protected HttpManager manager
The manager that created this request.


allowuserinteraction

protected boolean allowuserinteraction
Are we allowed to interact with the user ?


output

protected java.io.InputStream output
The request output stream, to PUT or POST data.


observer

protected RequestObserver observer
The observer for the request, if any.


pipeline

protected boolean pipeline
Can we pipeline that request, if appropriate support is detected ?


interrupted

protected boolean interrupted
Has this request been interrupted ?


server

protected HttpServer server
The server currently running the request, if any.

Constructor Detail

Request

protected Request(HttpManager manager)
Method Detail

setServer

protected void setServer(HttpServer server)
Mark that request has being run by given server.

Parameters:
server - The server in charge for that request.

unsetServer

protected void unsetServer()
Mark that request as no longer attached to a server object.


setPipeline

public void setPipeline(boolean onoff)
Enable/disable pipelining for that request. By default, this HTTP implementation tries it's best to use pipelining, if you take manual control over it, you're responsible for damages.

Parameters:
onoff - The pipelining toggle.

endEmit

protected void endEmit(java.io.OutputStream out,
                       int what)
                throws java.io.IOException
End of header emiting, continue by sending optional output stream.

Overrides:
endEmit in class HttpMessage
Parameters:
out - The output stream to write to.
Throws:
java.io.IOException - if an IO error occurs.

getAllowUserInteraction

public boolean getAllowUserInteraction()
Are we allowed to do some user interaction to run this request.

Returns:
A boolean, true if user interaction is allowed false otherwise.

setAllowUserInteraction

public void setAllowUserInteraction(boolean onoff)
Decide wether we are allowed to interact wit hthe user.

Parameters:
onoff - A boolean, true if interaction is allowed.

interruptRequest

public void interruptRequest()
Interrupt that request processing. Do whatever it takes to interrupt that request processing, as soon as possible.


isInterrupted

public boolean isInterrupted()
Has this request been interrupted ?

Returns:
A boolean.

getManager

public HttpManager getManager()
Get this request's manager.

Returns:
The instance of the manager taking care of this request.

setOutputStream

public void setOutputStream(java.io.InputStream in)
Set this request output stream. As a side effect, setting the body of the request will disable pipelining. If you know what you're doing, you can turn it on again by using the setPipeline method.

Parameters:
in - The data to send to the server.

hasOutputStream

public boolean hasOutputStream()
Does this request has an associated input stream ?

Returns:
A boolean true of it has.

getOutputStream

public java.io.InputStream getOutputStream()
Get the input stream to read that request body. Warning it is up to the caller to make sure to:

Returns:
An InputStream instance, or null if the request has no body.

makeReply

public Reply makeReply(int status)
Create a Reply instance matching this request.


setObserver

public void setObserver(RequestObserver observer)
Set the observer for this request.

Parameters:
observer - The observer.

getObserver

public RequestObserver getObserver()
Get the observer for this request.

Returns:
An instance of RequestObserver, or null if undefined.