public class HttpRequest extends HttpMessage
This class is not synchronized. It should be explicitly synchronized if it is used by multiple threads.
HttpResponse
HttpMessage.HeaderWriter
Modifier and Type | Field and Description |
---|---|
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 int |
__maxFormContentSize
Max size of the form content.
|
static int |
__maxLineLength
Maximum header line length.
|
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 |
__HTTP_0_9, __HTTP_1_0, __HTTP_1_1, __HTTP_1_X, __MSG_BAD, __MSG_EDITABLE, __MSG_RECEIVED, __MSG_SENDING, __MSG_SENT, __SCHEME, __SSL_SCHEME, __state, _attributes, _characterEncoding, _connection, _dotVersion, _header, _mimeType, _state, _version, _wrapper
Constructor and Description |
---|
HttpRequest()
Constructor.
|
HttpRequest(HttpConnection connection)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the request.
|
java.util.List |
getAcceptableTransferCodings()
Get the acceptable transfer encodings.
|
java.lang.String |
getAuthType() |
java.lang.String |
getAuthUser() |
Cookie[] |
getCookies()
Extract received cookies from a header.
|
java.lang.String |
getEncodedPath()
Get the encoded request path.
|
java.lang.String |
getHost()
Get the request host.
|
HttpResponse |
getHttpResponse()
Get the HTTP Response.
|
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.Map |
getParameterStringArrayMap() |
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 |
getRemoteHost() |
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()
Deprecated.
use getHttpResponse()
|
java.lang.StringBuffer |
getRootURL()
Reconstructs the URL the client used to make the request.
|
java.lang.String |
getScheme()
Get the request Scheme.
|
long |
getTimeStamp()
Get Request TimeStamp
|
java.lang.String |
getTimeStampStr()
Get Request TimeStamp
|
URI |
getURI()
Get the full URI.
|
java.security.Principal |
getUserPrincipal() |
java.lang.String |
getVersion()
Get the protocol version.
|
boolean |
hasUserPrincipal() |
boolean |
isConfidential() |
boolean |
isHandled()
Is the request handled.
|
boolean |
isIntegral() |
boolean |
isUserInRole(java.lang.String role) |
void |
readHeader(LineInput in)
Read the request line and header.
|
void |
setAuthType(java.lang.String a) |
void |
setAuthUser(java.lang.String user) |
void |
setHandled(boolean handled)
Set the handled status.
|
void |
setMethod(java.lang.String method) |
void |
setPath(java.lang.String path) |
void |
setQuery(java.lang.String q) |
void |
setTimeStamp(long ts) |
void |
setUserPrincipal(java.security.Principal principal) |
void |
writeHeader(java.io.Writer writer)
Write the request header.
|
void |
writeRequestLine(java.io.Writer writer)
Write the HTTP request line as it was received.
|
addDateField, addDateField, addField, addIntField, containsField, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDateField, getDotVersion, getField, getFieldNames, getFieldValues, getFieldValues, getHeader, getHttpConnection, getInputStream, getIntField, getMimeType, getOutputStream, getState, getWrapper, isCommitted, isDirty, removeAttribute, removeField, reset, setAttribute, setCharacterEncoding, setContentLength, setContentType, setDateField, setDateField, setField, setField, setIntField, setState, setVersion, setWrapper, toString, updateMimeType
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 int __maxFormContentSize
public static int __maxLineLength
public static final StringMap __methodCache
public static final StringMap __versionCache
public HttpRequest()
public HttpRequest(HttpConnection connection)
connection
- public java.lang.String getTimeStampStr()
public long getTimeStamp()
public void setTimeStamp(long ts)
public HttpResponse getResponse()
public HttpResponse getHttpResponse()
public boolean isHandled()
public void setHandled(boolean handled)
handled
- true or falsepublic void readHeader(LineInput in) throws java.io.IOException
in
- java.io.IOException
public void writeRequestLine(java.io.Writer writer) throws java.io.IOException
java.io.IOException
public void writeHeader(java.io.Writer writer) throws java.io.IOException
writer
- Http output streamjava.io.IOException
- IO problempublic java.lang.String getRequestLine()
public java.lang.String getMethod()
public void setMethod(java.lang.String method)
public java.lang.String getVersion()
HttpMessage
getVersion
in class HttpMessage
public java.lang.StringBuffer getRootURL()
Because this method returns a StringBuffer
, not a string, you can modify the
URL easily, for example, to append path and query parameters.
This method is useful for creating redirect messages and for reporting errors.
public 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 java.lang.String getScheme()
public boolean isIntegral()
public boolean isConfidential()
public java.lang.String getHost()
public int getPort()
public java.lang.String getPath()
public void setPath(java.lang.String path)
public java.lang.String getEncodedPath()
public java.lang.String getQuery()
public void setQuery(java.lang.String q)
public java.lang.String getRemoteAddr()
public java.lang.String getRemoteHost()
public 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 java.util.Map getParameterStringArrayMap()
public Cookie[] getCookies()
public boolean isUserInRole(java.lang.String role)
public java.lang.String getAuthType()
public void setAuthType(java.lang.String a)
public java.lang.String getAuthUser()
public void setAuthUser(java.lang.String user)
public boolean hasUserPrincipal()
public java.security.Principal getUserPrincipal()
public void setUserPrincipal(java.security.Principal principal)
public void destroy()
destroy
in class HttpMessage
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.