|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.http.HttpMessage | +--org.mortbay.http.HttpRequest
HTTP Request. This class manages the headers, trailers and content streams of a HTTP request. It can be used for receiving or generating requests. This class is not synchronized. It should be explicitly synchronized if it is used by multiple threads.
HttpResponse
Field Summary | |
static java.lang.String |
__AuthType
|
static java.lang.String |
__AuthUser
|
static java.lang.String |
__CONNECT
Request METHODS. |
static java.lang.String |
__DELETE
Request METHODS. |
static java.lang.String |
__GET
Request METHODS. |
static java.lang.String |
__HEAD
Request METHODS. |
static StringMap |
__methodCache
|
static java.lang.String |
__MOVE
Request METHODS. |
static java.lang.String |
__OPTIONS
Request METHODS. |
static java.lang.String |
__POST
Request METHODS. |
static java.lang.String |
__PUT
Request METHODS. |
static java.lang.String |
__TRACE
Request METHODS. |
static StringMap |
__versionCache
|
Fields inherited from class org.mortbay.http.HttpMessage |
__HTTP_0_9, __HTTP_1_0, __HTTP_1_1, __HTTP_1_X, __MSG_BAD, __MSG_EDITABLE, __MSG_RECEIVED, __MSG_SENDING, __MSG_SENT, __state |
Constructor Summary | |
HttpRequest()
Constructor. |
|
HttpRequest(HttpConnection connection)
Constructor. |
Method Summary | |
void |
appendRequestLine(java.lang.StringBuffer buf)
Append the HTTP request line as it was received. |
void |
destroy()
Destroy the request. |
java.lang.Object |
forceRemoveField(java.lang.String name)
Force a removeField. |
java.util.List |
getAcceptableTransferCodings()
Get the acceptable transfer encodings. |
java.lang.Object |
getAttribute(java.lang.String name)
Get a request attribute. |
java.util.Collection |
getAttributeNames()
Get Attribute names. |
Cookie[] |
getCookies()
Extract received cookies from a header. |
java.lang.String |
getHost()
Get the request host. |
java.lang.String |
getMethod()
Get the HTTP method for this request. |
java.lang.String |
getParameter(java.lang.String name)
Get a parameter value. |
java.util.Set |
getParameterNames()
Get the set of parameter names. |
MultiMap |
getParameters()
|
java.util.List |
getParameterValues(java.lang.String name)
Get multi valued paramater. |
java.lang.String |
getPath()
Get the request path. |
int |
getPort()
Get the request port. |
java.lang.String |
getQuery()
Get the request query. |
java.lang.String |
getRemoteAddr()
|
java.lang.String |
getRequestLine()
Return the HTTP request line as it was received. |
java.lang.StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request. |
HttpResponse |
getResponse()
Get the HTTP Response. |
java.lang.String |
getScheme()
Get the request Scheme. |
URI |
getURI()
Get the full URI. |
java.security.Principal |
getUserPrincipal()
|
boolean |
isHandled()
Is the request handled. |
boolean |
isUserInRole(java.lang.String role)
|
void |
readHeader(ChunkableInputStream in)
Read the request line and header. |
void |
recycle(HttpConnection connection)
Recycle the request. |
void |
removeAttribute(java.lang.String name)
Remove a request attribute. |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Set a request attribute. |
void |
setHandled(boolean handled)
Set the handled status. |
void |
setHost(java.lang.String host)
Set the request host. |
void |
setMethod(java.lang.String method)
Set the HTTP method for this request. |
void |
setPath(java.lang.String path)
Set the request path. |
void |
setPort(int port)
Set the request port. |
void |
setQuery(java.lang.String query)
Set the request query. |
void |
setScheme(java.lang.String scheme)
Set the request scheme. |
void |
setURI(URI uri)
Set the HTTP URI. |
void |
writeHeader(java.io.Writer writer)
Write the request header. |
Methods inherited from class org.mortbay.http.HttpMessage |
acceptTrailer, addDateField, addField, addIntField, commit, commitHeader, complete, containsField, getCharacterEncoding, getDateField, getDotVersion, getField, getFieldNames, getFieldValues, getFieldValues, getHeader, getHttpConnection, getInputStream, getIntField, getMimeType, getOutputStream, getState, getTrailer, getVersion, isCommitted, isDirty, removeField, setAcceptTrailer, setCurrentTime, setDateField, setDateField, setField, setField, setIntField, setState, setVersion, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String __GET
public static final java.lang.String __POST
public static final java.lang.String __HEAD
public static final java.lang.String __PUT
public static final java.lang.String __OPTIONS
public static final java.lang.String __DELETE
public static final java.lang.String __TRACE
public static final java.lang.String __CONNECT
public static final java.lang.String __MOVE
public static final StringMap __methodCache
public static final StringMap __versionCache
public static final java.lang.String __AuthType
public static final java.lang.String __AuthUser
Constructor Detail |
public HttpRequest()
public HttpRequest(HttpConnection connection)
connection
- Method Detail |
public HttpResponse getResponse()
public boolean isHandled()
public void setHandled(boolean handled)
handled
- true or falsepublic void readHeader(ChunkableInputStream in) throws java.io.IOException
in
- java.io.IOException
- public void writeHeader(java.io.Writer writer) throws java.io.IOException
out
- Chunkable output streamjava.io.IOException
- IO problempublic java.lang.String getRequestLine()
public void appendRequestLine(java.lang.StringBuffer buf)
public java.lang.String getMethod()
public void setMethod(java.lang.String method) throws java.lang.IllegalStateException
method
- the methodjava.lang.IllegalStateException
- Request is not EDITABLEpublic java.lang.StringBuffer getRequestURL()
Because this method returns a StringBuffer
,
not a string, you can modify the URL easily, for example,
to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
StringBuffer
object containing
the reconstructed URLpublic URI getURI()
public void setURI(URI uri)
uri
- the urijava.lang.IllegalStateException
- Request is not EDITABLEpublic java.lang.String getScheme()
public void setScheme(java.lang.String scheme)
scheme
- The schemejava.lang.IllegalStateException
- Request is not EDITABLEpublic java.lang.String getHost()
public void setHost(java.lang.String host) throws java.lang.IllegalStateException
host
- The hostjava.lang.IllegalStateException
- Request is not EDITABLEpublic int getPort()
public void setPort(int port) throws java.lang.IllegalStateException
port
- The portjava.lang.IllegalStateException
- Request is not EDITABLEpublic java.lang.String getPath()
public void setPath(java.lang.String path)
path
- The pathjava.lang.IllegalStateException
- Request is not EDITABLEpublic java.lang.String getQuery()
public void setQuery(java.lang.String query)
query
- The queryjava.lang.IllegalStateException
- Request is not EDITABLEpublic java.lang.String getRemoteAddr()
public java.lang.Object forceRemoveField(java.lang.String name)
name
- The field namepublic java.util.List getAcceptableTransferCodings()
public MultiMap getParameters()
public java.util.Set getParameterNames()
public java.lang.String getParameter(java.lang.String name)
name
- Parameter namepublic java.util.List getParameterValues(java.lang.String name)
name
- Parameter namepublic Cookie[] getCookies()
buffer
- Contains encoded cookiespublic java.lang.Object getAttribute(java.lang.String name)
name
- public java.lang.Object setAttribute(java.lang.String name, java.lang.Object attribute)
name
- attribute
- public java.util.Collection getAttributeNames()
public void removeAttribute(java.lang.String name)
name
- attribute
- public boolean isUserInRole(java.lang.String role)
public java.security.Principal getUserPrincipal()
public void recycle(HttpConnection connection)
recycle
in class HttpMessage
public void destroy()
destroy
in class HttpMessage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |