org.apache.catalina.connector
public class Request extends Object implements HttpServletRequest
Version: $Revision: 892545 $ $Date: 2009-12-20 02:04:17 +0100 (Sun, 20 Dec 2009) $
Field Summary | |
---|---|
protected HashMap | attributes
The attributes associated with this Request, keyed by attribute name. |
protected String | authType
Authentication type. |
protected boolean | comet
Comet state |
protected Connector | connector
Associated Catalina connector. |
protected Context | context
Associated context. |
protected Cookie[] | cookies
The set of cookies associated with this Request. |
protected boolean | cookiesParsed
Cookies parsed flag. |
protected Request | coyoteRequest
Coyote request. |
protected static int | CACHED_POST_LEN
Post data buffer. |
protected static Locale | defaultLocale
The default Locale if none are specified. |
protected Object | dispatcherType
The current dispatcher type. |
protected CometEventImpl | event
Associated event. |
protected RequestFacade | facade
The facade associated with this request. |
protected FilterChain | filterChain
Filter chain associated with the request. |
protected SimpleDateFormat[] | formats
The set of SimpleDateFormat formats to use in getDateHeader().
|
protected static TimeZone | GMT_ZONE |
protected static String | info
Descriptive information about this Request implementation. |
protected InputBuffer | inputBuffer
The associated input buffer. |
protected CoyoteInputStream | inputStream
ServletInputStream. |
protected String | localAddr
Local address |
protected ArrayList | locales
The preferred Locales assocaited with this Request. |
protected boolean | localesParsed
Parse locales. |
protected String | localName
Local address |
protected int | localPort
Local port |
protected MappingData | mappingData
Mapping data. |
protected ParameterMap | parameterMap
Hash map used in the getParametersMap method. |
protected boolean | parametersParsed
Request parameters parsed flag. |
protected byte[] | postData |
protected CoyoteReader | reader
Reader. |
protected String | remoteAddr
Remote address. |
protected String | remoteHost
Remote host. |
protected int | remotePort
Remote port |
protected Object | requestDispatcherPath
The current request dispatcher path. |
protected boolean | requestedSessionCookie
Was the requested session ID received in a cookie? |
protected String | requestedSessionId
The requested session ID (if any) for this request. |
protected boolean | requestedSessionURL
Was the requested session ID received in a URL? |
protected Response | response
The response with which this request is associated. |
protected boolean | secure
Secure flag. |
protected Session | session
The currently active session for this request. |
protected boolean | sessionParsed
Session parsed flag. |
protected static StringManager | sm
The string manager for this package. |
protected Subject | subject
The Subject associated with the current AccessControllerContext |
protected Principal | userPrincipal
User principal. |
protected boolean | usingInputStream
Using stream flag. |
protected boolean | usingReader
Using writer flag. |
protected B2CConverter | URIConverter
URI byte to char converter (not recycled). |
protected Wrapper | wrapper
Associated wrapper. |
Constructor Summary | |
---|---|
Request() |
Method Summary | |
---|---|
void | addCookie(Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request.
|
void | addHeader(String name, String value)
Add a Header to the set of Headers associated with this Request.
|
void | addLocale(Locale locale)
Add a Locale to the set of preferred Locales for this Request. |
void | addParameter(String name, String[] values)
Add a parameter name and corresponding set of values to this Request.
|
void | changeSessionId(String newSessionId)
Change the ID of the session that this request is associated with. |
void | clearCookies()
Clear the collection of Cookies associated with this Request. |
void | clearEncoders()
Clear cached encoders (to save memory for Comet requests). |
void | clearHeaders()
Clear the collection of Headers associated with this Request. |
void | clearLocales()
Clear the collection of Locales associated with this Request. |
void | clearParameters()
Clear the collection of parameters associated with this Request. |
void | cometClose() |
protected void | configureSessionCookie(Cookie cookie)
Configures the given JSESSIONID cookie.
|
ServletInputStream | createInputStream()
Create and return a ServletInputStream to read the content
associated with this Request.
|
protected Session | doGetSession(boolean create) |
void | finishRequest()
Perform whatever actions are required to flush and close the input
stream or reader, in a single operation.
|
Object | getAttribute(String name)
Return the specified request attribute if it exists; otherwise, return
null .
|
Enumeration | getAttributeNames()
Return the names of all request attributes for this Request, or an
empty Enumeration if there are none. |
String | getAuthType()
Return the authentication type used for this Request. |
boolean | getAvailable()
Return true if bytes are available. |
String | getCharacterEncoding()
Return the character encoding for this Request. |
Connector | getConnector()
Return the Connector through which this Request was received. |
int | getContentLength()
Return the content length for this Request. |
String | getContentType()
Return the content type for this Request. |
Context | getContext()
Return the Context within which this Request is being processed. |
String | getContextPath()
Return the portion of the request URI used to select the Context
of the Request. |
MessageBytes | getContextPathMB()
Get the context path.
|
Cookie[] | getCookies()
Return the set of Cookies received with this Request. |
Request | getCoyoteRequest()
Get the Coyote request. |
long | getDateHeader(String name)
Return the value of the specified date header, if any; otherwise
return -1.
|
String | getDecodedRequestURI()
Get the decoded request URI.
|
MessageBytes | getDecodedRequestURIMB()
Get the decoded request URI.
|
CometEventImpl | getEvent()
Get the event associated with the request. |
FilterChain | getFilterChain()
Get filter chain associated with the request. |
String | getHeader(String name)
Return the first value of the specified header, if any; otherwise,
return null
|
Enumeration | getHeaderNames()
Return the names of all headers received with this request. |
Enumeration | getHeaders(String name)
Return all of the values of the specified header, if any; otherwise,
return an empty enumeration.
|
Host | getHost()
Return the Host within which this Request is being processed. |
String | getInfo()
Return descriptive information about this Request implementation and
the corresponding version number, in the format
<description>/<version> . |
ServletInputStream | getInputStream()
Return the servlet input stream for this Request. |
int | getIntHeader(String name)
Return the value of the specified header as an integer, or -1 if there
is no such header for this request.
|
String | getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on
which the request was received. |
Locale | getLocale()
Return the preferred Locale that the client will accept content in,
based on the value for the first Accept-Language header
that was encountered. |
Enumeration | getLocales()
Return the set of preferred Locales that the client will accept
content in, based on the values for any Accept-Language
headers that were encountered. |
String | getLocalName()
Returns the host name of the Internet Protocol (IP) interface on
which the request was received. |
int | getLocalPort()
Returns the Internet Protocol (IP) port number of the interface
on which the request was received. |
MappingData | getMappingData()
Return mapping data. |
String | getMethod()
Return the HTTP request method used in this Request. |
Object | getNote(String name)
Return the object bound with the specified name to the internal notes
for this request, or null if no such binding exists.
|
Iterator | getNoteNames()
Return an Iterator containing the String names of all notes bindings
that exist for this request. |
String | getParameter(String name)
Return the value of the specified request parameter, if any; otherwise,
return null . |
Map | getParameterMap()
Returns a Map of the parameters of this request.
|
Enumeration | getParameterNames()
Return the names of all defined request parameters for this request. |
String[] | getParameterValues(String name)
Return the defined values for the specified request parameter, if any;
otherwise, return null .
|
String | getPathInfo()
Return the path information associated with this Request. |
MessageBytes | getPathInfoMB()
Get the path info.
|
String | getPathTranslated()
Return the extra path information for this request, translated
to a real path. |
Principal | getPrincipal()
Return the principal that has been authenticated for this Request. |
String | getProtocol()
Return the protocol and version used to make this Request. |
String | getQueryString()
Return the query string associated with this request. |
BufferedReader | getReader()
Read the Reader wrapping the input stream for this Request. |
String | getRealPath(String path)
Return the real path of the specified virtual path.
|
String | getRemoteAddr()
Return the remote IP address making this Request. |
String | getRemoteHost()
Return the remote host name making this Request. |
int | getRemotePort()
Returns the Internet Protocol (IP) source port of the client
or last proxy that sent the request. |
String | getRemoteUser()
Return the name of the remote user that has been authenticated
for this Request. |
HttpServletRequest | getRequest()
Return the ServletRequest for which this object
is the facade. |
RequestDispatcher | getRequestDispatcher(String path)
Return a RequestDispatcher that wraps the resource at the specified
path, which may be interpreted as relative to the current request path.
|
String | getRequestedSessionId()
Return the session identifier included in this request, if any. |
MessageBytes | getRequestPathMB()
Get the request path.
|
String | getRequestURI()
Return the request URI for this request. |
StringBuffer | getRequestURL()
Reconstructs the URL the client used to make the request.
|
Response | getResponse()
Return the Response with which this Request is associated. |
String | getScheme()
Return the scheme used to make this Request. |
String | getServerName()
Return the server name responding to this Request. |
int | getServerPort()
Return the server port responding to this Request. |
String | getServletPath()
Return the portion of the request URI used to select the servlet
that will process this request. |
MessageBytes | getServletPathMB()
Get the servlet path.
|
HttpSession | getSession()
Return the session associated with this Request, creating one
if necessary. |
HttpSession | getSession(boolean create)
Return the session associated with this Request, creating one
if necessary and requested.
|
Session | getSessionInternal()
Return the session associated with this Request, creating one
if necessary. |
Session | getSessionInternal(boolean create)
Return the session associated with this Request, creating one
if necessary and requested.
|
InputStream | getStream()
Return the input stream associated with this Request. |
protected B2CConverter | getURIConverter()
Return the URI converter. |
Principal | getUserPrincipal()
Return the principal that has been authenticated for this Request. |
Wrapper | getWrapper()
Return the Wrapper within which this Request is being processed. |
protected static boolean | isAlpha(String value) |
boolean | isComet()
Return true if the current request is handling Comet traffic. |
boolean | isParametersParsed()
return true if we have parsed parameters |
boolean | isRequestedSessionIdFromCookie()
Return true if the session identifier included in this
request came from a cookie. |
boolean | isRequestedSessionIdFromUrl()
Return true if the session identifier included in this
request came from the request URI.
|
boolean | isRequestedSessionIdFromURL()
Return true if the session identifier included in this
request came from the request URI. |
boolean | isRequestedSessionIdValid()
Return true if the session identifier included in this
request identifies a valid session. |
boolean | isSecure()
Was this request received on a secure connection? |
boolean | isUserInRole(String role)
Return true if the authenticated user principal
possesses the specified role name.
|
protected void | parseCookies()
Parse cookies. |
protected void | parseLocales()
Parse request locales. |
protected void | parseLocalesHeader(String value)
Parse accept-language header value. |
protected void | parseParameters()
Parse request parameters. |
boolean | read()
Clear cached encoders (to save memory for Comet requests). |
protected byte[] | readChunkedPostBody()
Read chunked post body. |
protected int | readPostBody(byte[] body, int len)
Read post body in an array. |
void | recycle()
Release all object references, and initialize instance variables, in
preparation for reuse of this object. |
void | removeAttribute(String name)
Remove the specified request attribute if it exists.
|
void | removeNote(String name)
Remove any object bound to the specified name in the internal notes
for this request.
|
void | setAttribute(String name, Object value)
Set the specified request attribute to the specified value.
|
void | setAuthType(String type)
Set the authentication type used for this request, if any; otherwise
set the type to null . |
void | setCharacterEncoding(String enc)
Overrides the name of the character encoding used in the body of
this request. |
void | setComet(boolean comet)
Set comet state. |
void | setCometTimeout(long timeout) |
void | setConnector(Connector connector)
Set the Connector through which this Request was received.
|
void | setContentLength(int length)
Set the content length associated with this Request.
|
void | setContentType(String type)
Set the content type (and optionally the character encoding)
associated with this Request. |
void | setContext(Context context)
Set the Context within which this Request is being processed. |
void | setContextPath(String path)
Set the context path for this Request. |
void | setCookies(Cookie[] cookies)
Set the set of cookies recieved with this Request. |
void | setCoyoteRequest(Request coyoteRequest)
Set the Coyote request.
|
void | setDecodedRequestURI(String uri)
Set the decoded request URI.
|
void | setFilterChain(FilterChain filterChain)
Set filter chain associated with the request.
|
void | setHost(Host host)
Set the Host within which this Request is being processed. |
void | setMethod(String method)
Set the HTTP request method used for this Request.
|
void | setNote(String name, Object value)
Bind an object to a specified name in the internal notes associated
with this request, replacing any existing binding for this name.
|
void | setPathInfo(String path)
Set the path information for this Request. |
void | setProtocol(String protocol)
Set the protocol name and version associated with this Request.
|
void | setQueryString(String query)
Set the query string for this Request. |
void | setRemoteAddr(String remoteAddr)
Set the IP address of the remote client associated with this Request.
|
void | setRemoteHost(String remoteHost)
Set the fully qualified name of the remote client associated with this
Request.
|
void | setRequestedSessionCookie(boolean flag)
Set a flag indicating whether or not the requested session ID for this
request came in through a cookie. |
void | setRequestedSessionId(String id)
Set the requested session ID for this request. |
void | setRequestedSessionURL(boolean flag)
Set a flag indicating whether or not the requested session ID for this
request came in through a URL. |
void | setRequestURI(String uri)
Set the unparsed request URI for this Request. |
void | setResponse(Response response)
Set the Response with which this Request is associated.
|
void | setScheme(String scheme)
Set the name of the scheme associated with this request. |
void | setSecure(boolean secure)
Set the value to be returned by isSecure()
for this Request.
|
void | setServerName(String name)
Set the name of the server (virtual host) to process this request.
|
void | setServerPort(int port)
Set the port number of the server to process this request.
|
void | setServletPath(String path)
Set the servlet path for this Request. |
void | setStream(InputStream stream)
Set the input stream associated with this Request.
|
protected void | setURIConverter(B2CConverter URIConverter)
Set the URI converter.
|
void | setUserPrincipal(Principal principal)
Set the Principal who has been authenticated for this Request. |
void | setWrapper(Wrapper wrapper)
Set the Wrapper within which this Request is being processed. |
protected String | unescape(String s) |
Parameters: cookie The new cookie
Parameters: name The new header name value The new header value
Parameters: locale The new preferred Locale
Parameters: name Name of this request parameter values Corresponding values for this request parameter
Parameters: session The session to change the session ID for
Parameters: cookie The JSESSIONID cookie to be configured
Throws: IOException if an input/output error occurs
Throws: IOException if an input/output error occurs
null
.
Parameters: name Name of the request attribute to return
Enumeration
if there are none. Note that the attribute
names return will only be those for the attributes set via
Request. Tomcat internal attributes will
not be included although they are accessible via
getAttribute. The Tomcat internal attributes include:
Returns: the context path
Parameters: name Name of the requested date header
Throws: IllegalArgumentException if the specified header value cannot be converted to a date
Returns: the URL decoded request URI
Returns: the URL decoded request URI
Returns:
null
Parameters: name Name of the requested header
Parameters: name Name of the requested header
<description>/<version>
.createInputStream()
.
Throws: IllegalStateException if getReader()
has
already been called for this request IOException if an input/output error occurs
Parameters: name Name of the requested header
Throws: IllegalArgumentException if the specified header value cannot be converted to an integer
Accept-Language
header
that was encountered. If the request did not specify a preferred
language, the server's default Locale is returned.Accept-Language
headers that were encountered. If the request did not specify a
preferred language, the server's default Locale is returned.null
if no such binding exists.
Parameters: name Name of the note to be returned
null
. If there is more than one value defined,
return only the first one.
Parameters: name Name of the desired request parameter
Map
of the parameters of this request.
Request parameters are extra information sent with the request.
For HTTP servlets, parameters are contained in the query string
or posted form data.
Returns: A Map
containing parameter names as keys
and parameter values as map values.
null
.
Parameters: name Name of the desired request parameter
Returns: the path info
BufferedReader
around the
servlet input stream returned by createInputStream()
.
Throws: IllegalStateException if getInputStream()
has already been called for this request IOException if an input/output error occurs
Deprecated: As of version 2.1 of the Java Servlet API, use
ServletContext.getRealPath()
.
Parameters: path Path to be translated
ServletRequest
for which this object
is the facade. This method must be implemented by a subclass.Parameters: path Path of the resource to be wrapped
Returns: the request path
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.
Returns: A StringBuffer
object containing the
reconstructed URL
Returns: the servlet path
Parameters: create Create a new session if one does not exist
Parameters: create Create a new session if one does not exist
true
if the session identifier included in this
request came from a cookie.Deprecated: As of Version 2.1 of the Java Servlet API, use
isRequestedSessionIdFromURL()
instead.
true
if the session identifier included in this
request came from the request URI.
true
if the session identifier included in this
request came from the request URI.true
if the session identifier included in this
request identifies a valid session.true
if the authenticated user principal
possesses the specified role name.
Parameters: role Role name to be validated
Parameters: name Name of the request attribute to remove
Parameters: name Name of the note to be removed
Parameters: name Name of the request attribute to set value The associated value
null
. Typical values are "BASIC",
"DIGEST", or "SSL".
Parameters: type The authentication type used
getReader()
.
Parameters: enc The character encoding to be used
Throws: UnsupportedEncodingException if the specified encoding is not supported
Since: Servlet 2.3
Parameters: connector The new connector
Parameters: length The new content length
text/html; charset=ISO-8859-4
.
Parameters: type The new content type
getContextPath()
,
and thus enables parsing of the request URI.
Parameters: context The newly associated Context
Parameters: path The context path
Parameters: coyoteRequest The Coyote request
Parameters: uri The decoded request URI
Parameters: filterChain new filter chain
Parameters: host The newly associated Host
Parameters: method The request method
Parameters: name Name to which the object should be bound value Object to be bound to the specified name
Parameters: path The path information
Parameters: protocol Protocol name and version
Parameters: query The query string
Parameters: remoteAddr The remote IP address
Parameters: remoteHost The remote host name
Parameters: flag The new flag
Parameters: id The new session id
Parameters: flag The new flag
Parameters: uri The request URI
Parameters: response The new associated response
http
, https
, and ftp
.
Parameters: scheme The scheme
isSecure()
for this Request.
Parameters: secure The new isSecure value
Parameters: name The server name
Parameters: port The server port
Parameters: path The servlet path
Parameters: stream The new input stream
Parameters: URIConverter the new URI connverter
getRemoteUser()
method.
Parameters: principal The user Principal
Parameters: wrapper The newly associated Wrapper