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 String |
__CONNECT
Request METHODS.
|
static String |
__DELETE
Request METHODS.
|
static String |
__GET
Request METHODS.
|
static String |
__HEAD
Request METHODS.
|
static int |
__maxFormContentSize
Max size of the form content.
|
static int |
__maxLineLength
Maximum header line length.
|
static StringMap |
__methodCache |
static String |
__MOVE
Request METHODS.
|
static String |
__OPTIONS
Request METHODS.
|
static String |
__POST
Request METHODS.
|
static String |
__PUT
Request METHODS.
|
static 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.
|
List |
getAcceptableTransferCodings()
Get the acceptable transfer encodings.
|
String |
getAuthType() |
String |
getAuthUser() |
javax.servlet.http.Cookie[] |
getCookies()
Extract received cookies from a header.
|
String |
getEncodedPath()
Get the encoded request path.
|
String |
getHost()
Get the request host.
|
HttpResponse |
getHttpResponse()
Get the HTTP Response.
|
String |
getMethod()
Get the HTTP method for this request.
|
String |
getParameter(String name)
Get a parameter value.
|
Set |
getParameterNames()
Get the set of parameter names.
|
MultiMap |
getParameters() |
Map |
getParameterStringArrayMap() |
List |
getParameterValues(String name)
Get multi valued paramater.
|
String |
getPath()
Get the request path.
|
int |
getPort()
Get the request port.
|
String |
getQuery()
Get the request query.
|
String |
getRemoteAddr() |
String |
getRemoteHost() |
String |
getRequestLine()
Return the HTTP request line as it was received.
|
StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request.
|
HttpResponse |
getResponse()
Deprecated.
use getHttpResponse()
|
StringBuffer |
getRootURL()
Reconstructs the URL the client used to make the request.
|
String |
getScheme()
Get the request Scheme.
|
long |
getTimeStamp()
Get Request TimeStamp
|
String |
getTimeStampStr()
Get Request TimeStamp
|
URI |
getURI()
Get the full URI.
|
Principal |
getUserPrincipal() |
String |
getVersion()
Get the protocol version.
|
boolean |
hasUserPrincipal() |
boolean |
isConfidential() |
boolean |
isHandled()
Is the request handled.
|
boolean |
isIntegral() |
boolean |
isUserInRole(String role) |
void |
readHeader(LineInput in)
Read the request line and header.
|
void |
setAuthType(String a) |
void |
setAuthUser(String user) |
void |
setHandled(boolean handled)
Set the handled status.
|
void |
setMethod(String method) |
void |
setPath(String path) |
void |
setQuery(String q) |
void |
setTimeStamp(long ts) |
void |
setURI(URI uri) |
void |
setUserPrincipal(Principal principal) |
void |
writeHeader(Writer writer)
Write the request header.
|
void |
writeRequestLine(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 String __GET
public static final String __POST
public static final String __HEAD
public static final String __PUT
public static final String __OPTIONS
public static final String __DELETE
public static final String __TRACE
public static final String __CONNECT
public static final 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 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 IOException
in
- IOException
public void writeRequestLine(Writer writer) throws IOException
IOException
public void writeHeader(Writer writer) throws IOException
writer
- Http output streamIOException
- IO problempublic String getRequestLine()
public String getMethod()
public void setMethod(String method)
public String getVersion()
HttpMessage
getVersion
in class HttpMessage
public 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 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 String getScheme()
public boolean isIntegral()
public boolean isConfidential()
public String getHost()
public int getPort()
public String getPath()
public void setPath(String path)
public String getEncodedPath()
public String getQuery()
public void setQuery(String q)
public String getRemoteAddr()
public String getRemoteHost()
public List getAcceptableTransferCodings()
public MultiMap getParameters()
public Set getParameterNames()
public String getParameter(String name)
name
- Parameter namepublic List getParameterValues(String name)
name
- Parameter namepublic Map getParameterStringArrayMap()
public javax.servlet.http.Cookie[] getCookies()
public boolean isUserInRole(String role)
public String getAuthType()
public void setAuthType(String a)
public String getAuthUser()
public void setAuthUser(String user)
public boolean hasUserPrincipal()
public Principal getUserPrincipal()
public void setUserPrincipal(Principal principal)
public void destroy()
destroy
in class HttpMessage
public void setURI(URI uri)
Copyright © 2016. All Rights Reserved.