|
|||||||||
| Home >> All >> org >> mortbay >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mortbay.http
Class HttpRequest

java.lang.Objectorg.mortbay.http.HttpMessage
org.mortbay.http.HttpRequest
- public class HttpRequest
- extends HttpMessage
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.
- Version:
- $Id: HttpRequest.java,v 1.72 2003/11/22 16:06:02 gregwilkins Exp $
| Nested Class Summary |
| Nested classes inherited from class org.mortbay.http.HttpMessage |
HttpMessage.HeaderWriter |
| 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, __SCHEME, __SSL_SCHEME, __state, _attributes, _characterEncoding, _connection, _dotVersion, _header, _mimeType, _state, _version, _wrapper |
| Constructor Summary | |
HttpRequest()
Constructor. |
|
HttpRequest(HttpConnection connection)
Constructor. |
|
| Method Summary | |
(package private) void |
decodeRequestLine(char[] buf,
int len)
Decode HTTP request line. |
void |
destroy()
Destroy the request. |
private void |
extractParameters()
|
(package private) java.lang.Object |
forceRemoveField(java.lang.String name)
Force a removeField. |
java.util.List |
getAcceptableTransferCodings()
Get the acceptable transfer encodings. |
java.lang.String |
getAuthType()
|
java.lang.String |
getAuthUser()
|
javax.servlet.http.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. |
org.mortbay.util.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 |
org.mortbay.util.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(org.mortbay.util.LineInput in)
Read the request line and header. |
(package private) void |
recycle(HttpConnection connection)
Recycle the request. |
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
log
private static org.apache.commons.logging.Log log
__GET
public static final java.lang.String __GET
- Request METHODS.
- See Also:
- Constant Field Values
__POST
public static final java.lang.String __POST
- Request METHODS.
- See Also:
- Constant Field Values
__HEAD
public static final java.lang.String __HEAD
- Request METHODS.
- See Also:
- Constant Field Values
__PUT
public static final java.lang.String __PUT
- Request METHODS.
- See Also:
- Constant Field Values
__OPTIONS
public static final java.lang.String __OPTIONS
- Request METHODS.
- See Also:
- Constant Field Values
__DELETE
public static final java.lang.String __DELETE
- Request METHODS.
- See Also:
- Constant Field Values
__TRACE
public static final java.lang.String __TRACE
- Request METHODS.
- See Also:
- Constant Field Values
__CONNECT
public static final java.lang.String __CONNECT
- Request METHODS.
- See Also:
- Constant Field Values
__MOVE
public static final java.lang.String __MOVE
- Request METHODS.
- See Also:
- Constant Field Values
__maxFormContentSize
public static int __maxFormContentSize
- Max size of the form content.
Limits the size of the data a client can push at the server.
Set via the org.mortbay.http.HttpRequest.maxContentSize
system property.
__maxLineLength
public static int __maxLineLength
- Maximum header line length.
__methodCache
public static final org.mortbay.util.StringMap __methodCache
__versionCache
public static final org.mortbay.util.StringMap __versionCache
__noCookies
private static javax.servlet.http.Cookie[] __noCookies
_method
private java.lang.String _method
_uri
private org.mortbay.util.URI _uri
_host
private java.lang.String _host
_hostPort
private java.lang.String _hostPort
_port
private int _port
_te
private java.util.List _te
_parameters
private org.mortbay.util.MultiMap _parameters
_paramsExtracted
private boolean _paramsExtracted
_handled
private boolean _handled
_cookies
private javax.servlet.http.Cookie[] _cookies
_lastCookies
private java.lang.String[] _lastCookies
_cookiesExtracted
private boolean _cookiesExtracted
_timeStamp
private long _timeStamp
_timeStampStr
private java.lang.String _timeStampStr
_userPrincipal
private java.security.Principal _userPrincipal
_authUser
private java.lang.String _authUser
_authType
private java.lang.String _authType
__NO_USER
private static java.security.Principal __NO_USER
| Constructor Detail |
HttpRequest
public HttpRequest()
- Constructor.
HttpRequest
public HttpRequest(HttpConnection connection)
- Constructor.
| Method Detail |
getTimeStampStr
public java.lang.String getTimeStampStr()
- Get Request TimeStamp
getTimeStamp
public long getTimeStamp()
- Get Request TimeStamp
setTimeStamp
public void setTimeStamp(long ts)
getResponse
public HttpResponse getResponse()
- Deprecated. use getHttpResponse()
getHttpResponse
public HttpResponse getHttpResponse()
- Get the HTTP Response.
Get the HTTP Response associated with this request.
isHandled
public boolean isHandled()
- Is the request handled.
setHandled
public void setHandled(boolean handled)
- Set the handled status.
readHeader
public void readHeader(org.mortbay.util.LineInput in) throws java.io.IOException
- Read the request line and header.
writeRequestLine
public void writeRequestLine(java.io.Writer writer) throws java.io.IOException
- Write the HTTP request line as it was received.
writeHeader
public void writeHeader(java.io.Writer writer) throws java.io.IOException
- Write the request header.
Places the message in __MSG_SENDING state.
- Specified by:
writeHeaderin classHttpMessage
getRequestLine
public java.lang.String getRequestLine()
- Return the HTTP request line as it was received.
getMethod
public java.lang.String getMethod()
- Get the HTTP method for this request.
Returns the method with which the request was made. The returned
value can be "GET", "HEAD", "POST", or an extension method. Same
as the CGI variable REQUEST_METHOD.
setMethod
public void setMethod(java.lang.String method)
getVersion
public java.lang.String getVersion()
- Description copied from class:
HttpMessage - Get the protocol version.
- Overrides:
getVersionin classHttpMessage
getRootURL
public java.lang.StringBuffer getRootURL()
- Reconstructs the URL the client used to make the request.
The returned URL contains a protocol, server name, port
number, and, but it does not include a path.
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.
getRequestURL
public java.lang.StringBuffer getRequestURL()
- Reconstructs the URL the client used to make the request.
The returned URL contains a protocol, server name, port
number, and server path, but it does not include query
string parameters.
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.
getURI
public org.mortbay.util.URI getURI()
- Get the full URI.
getScheme
public java.lang.String getScheme()
- Get the request Scheme.
The scheme is obtained from an absolute URI. If the URI in
the request is not absolute, then the connections default
scheme is returned. If there is no connection "http" is returned.
isIntegral
public boolean isIntegral()
isConfidential
public boolean isConfidential()
getHost
public java.lang.String getHost()
- Get the request host.
getPort
public int getPort()
- Get the request port.
The port is obtained either from an absolute URI, the HTTP
Host header field, the connection or the default.
getPath
public java.lang.String getPath()
- Get the request path.
setPath
public void setPath(java.lang.String path)
getEncodedPath
public java.lang.String getEncodedPath()
- Get the encoded request path.
getQuery
public java.lang.String getQuery()
- Get the request query.
setQuery
public void setQuery(java.lang.String q)
getRemoteAddr
public java.lang.String getRemoteAddr()
getRemoteHost
public java.lang.String getRemoteHost()
decodeRequestLine
void decodeRequestLine(char[] buf,
int len)
throws java.io.IOException
- Decode HTTP request line.
forceRemoveField
java.lang.Object forceRemoveField(java.lang.String name)
- Force a removeField.
This call ignores the message state and forces a field
to be removed from the request. It is required for the
handling of the Connection field.
getAcceptableTransferCodings
public java.util.List getAcceptableTransferCodings()
- Get the acceptable transfer encodings.
The TE field is used to construct a list of acceptable
extension transfer codings in quality order.
An empty list implies that only "chunked" is acceptable.
A null list implies that no transfer coding can be applied.
If the "trailer" coding is found in the TE field, then
message trailers are enabled in any linked response.
extractParameters
private void extractParameters()
getParameters
public org.mortbay.util.MultiMap getParameters()
getParameterNames
public java.util.Set getParameterNames()
- Get the set of parameter names.
getParameter
public java.lang.String getParameter(java.lang.String name)
- Get a parameter value.
getParameterValues
public java.util.List getParameterValues(java.lang.String name)
- Get multi valued paramater.
getParameterStringArrayMap
public java.util.Map getParameterStringArrayMap()
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Extract received cookies from a header.
isUserInRole
public boolean isUserInRole(java.lang.String role)
getAuthType
public java.lang.String getAuthType()
setAuthType
public void setAuthType(java.lang.String a)
getAuthUser
public java.lang.String getAuthUser()
setAuthUser
public void setAuthUser(java.lang.String user)
hasUserPrincipal
public boolean hasUserPrincipal()
getUserPrincipal
public java.security.Principal getUserPrincipal()
setUserPrincipal
public void setUserPrincipal(java.security.Principal principal)
recycle
void recycle(HttpConnection connection)
- Recycle the request.
- Overrides:
recyclein classHttpMessage
destroy
public void destroy()
- Destroy the request.
Help the garbage collector by null everything that we can.
- Overrides:
destroyin classHttpMessage
|
|||||||||
| Home >> All >> org >> mortbay >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC