|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.coyote.tomcat4.CoyoteRequest
Wrapper object for the Coyote request.
Nested Class Summary | |
protected class |
CoyoteRequest.PrivilegedGetSession
|
Field Summary | |
protected java.util.HashMap |
attributes
The attributes associated with this Request, keyed by attribute name. |
protected java.lang.String |
authorization
The authorization credentials sent with this Request. |
protected java.lang.String |
authType
Authentication type. |
protected static int |
CACHED_POST_LEN
Post data buffer. |
protected CoyoteConnector |
connector
Associated Catalina connector. |
protected Context |
context
The Context within which this Request is being processed. |
protected java.lang.String |
contextPath
Context path. |
protected Cookie[] |
cookies
The set of cookies associated with this Request. |
protected Request |
coyoteRequest
Coyote request. |
protected static java.util.Locale |
defaultLocale
The default Locale if none are specified. |
protected CoyoteRequestFacade |
facade
The facade associated with this request. |
protected java.text.SimpleDateFormat[] |
formats
The set of SimpleDateFormat formats to use in getDateHeader(). |
protected static java.lang.String |
info
Descriptive information about this Request implementation. |
protected CoyoteInputStream |
inputStream
ServletInputStream. |
protected java.util.ArrayList |
locales
The preferred Locales assocaited with this Request. |
protected boolean |
localesParsed
Parse locales. |
protected ParameterMap |
parameterMap
Hash map used in the getParametersMap method. |
protected java.lang.String |
pathInfo
Path info. |
protected byte[] |
postData
|
protected java.io.BufferedReader |
reader
Reader. |
protected java.lang.String |
remoteAddr
Remote address. |
protected java.lang.String |
remoteHost
Remote host. |
protected boolean |
requestedSessionCookie
Was the requested session ID received in a cookie? |
protected java.lang.String |
requestedSessionId
The requested session ID (if any) for this request. |
protected boolean |
requestedSessionURL
Was the requested session ID received in a URL? |
protected boolean |
requestParametersParsed
Request parameters parsed flag. |
protected org.apache.catalina.Response |
response
The response with which this request is associated. |
protected boolean |
secure
Secure flag. |
protected java.lang.String |
servletPath
Servlet path. |
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 java.net.Socket |
socket
The socket through which this Request was received. |
protected B2CConverter |
URIConverter
URI byte to char converter (not recycled). |
protected java.security.Principal |
userPrincipal
User principal. |
protected boolean |
usingInputStream
Using stream flag. |
protected boolean |
usingReader
Using writer flag. |
protected Wrapper |
wrapper
The Wrapper within which this Request is being processed. |
Constructor Summary | |
CoyoteRequest()
|
Method Summary | |
void |
addCookie(Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request. |
void |
addHeader(java.lang.String name,
java.lang.String value)
Add a Header to the set of Headers associated with this Request. |
void |
addLocale(java.util.Locale locale)
Add a Locale to the set of preferred Locales for this Request. |
void |
addParameter(java.lang.String name,
java.lang.String[] values)
Add a parameter name and corresponding set of values to this Request. |
void |
clearCookies()
Clear the collection of Cookies associated with this Request. |
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. |
ServletInputStream |
createInputStream()
Create and return a ServletInputStream to read the content associated with this Request. |
protected HttpSession |
doGetSession(boolean create)
|
void |
finishRequest()
Perform whatever actions are required to flush and close the input stream or reader, in a single operation. |
java.lang.Object |
getAttribute(java.lang.String name)
Return the specified request attribute if it exists; otherwise, return null . |
java.util.Enumeration |
getAttributeNames()
Return the names of all request attributes for this Request, or an empty Enumeration if there are none. |
java.lang.String |
getAuthorization()
Return the authorization credentials sent with this request. |
java.lang.String |
getAuthType()
Return the authentication type used for this Request. |
java.lang.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. |
java.lang.String |
getContentType()
Return the content type for this Request. |
Context |
getContext()
Return the Context within which this Request is being processed. |
java.lang.String |
getContextPath()
Return the portion of the request URI used to select the Context of the Request. |
Cookie[] |
getCookies()
Return the set of Cookies received with this Request. |
Request |
getCoyoteRequest()
Get the Coyote request. |
long |
getDateHeader(java.lang.String name)
Return the value of the specified date header, if any; otherwise return -1. |
java.lang.String |
getDecodedRequestURI()
Get the decoded request URI. |
java.lang.String |
getHeader(java.lang.String name)
Return the first value of the specified header, if any; otherwise, return null |
java.util.Enumeration |
getHeaderNames()
Return the names of all headers received with this request. |
java.util.Enumeration |
getHeaders(java.lang.String name)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration. |
java.lang.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(java.lang.String name)
Return the value of the specified header as an integer, or -1 if there is no such header for this request. |
java.util.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. |
java.util.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. |
java.lang.String |
getMethod()
Return the HTTP request method used in this Request. |
java.lang.Object |
getNote(java.lang.String name)
Return the object bound with the specified name to the internal notes for this request, or null if no such binding exists. |
java.util.Iterator |
getNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this request. |
java.lang.String |
getParameter(java.lang.String name)
Return the value of the specified request parameter, if any; otherwise, return null . |
java.util.Map |
getParameterMap()
Returns a Map of the parameters of this request. |
java.util.Enumeration |
getParameterNames()
Return the names of all defined request parameters for this request. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Return the defined values for the specified request parameter, if any; otherwise, return null . |
java.lang.String |
getPathInfo()
Return the path information associated with this Request. |
java.lang.String |
getPathTranslated()
Return the extra path information for this request, translated to a real path. |
java.lang.String |
getProtocol()
Return the protocol and version used to make this Request. |
java.lang.String |
getQueryString()
Return the query string associated with this request. |
java.io.BufferedReader |
getReader()
Read the Reader wrapping the input stream for this Request. |
java.lang.String |
getRealPath(java.lang.String path)
Deprecated. As of version 2.1 of the Java Servlet API, use ServletContext.getRealPath() . |
java.lang.String |
getRemoteAddr()
Return the remote IP address making this Request. |
java.lang.String |
getRemoteHost()
Return the remote host name making this Request. |
java.lang.String |
getRemoteUser()
Return the name of the remote user that has been authenticated for this Request. |
ServletRequest |
getRequest()
Return the ServletRequest for which this object
is the facade. |
RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path. |
java.lang.String |
getRequestedSessionId()
Return the session identifier included in this request, if any. |
java.lang.String |
getRequestURI()
Return the request URI for this request. |
java.lang.StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request. |
org.apache.catalina.Response |
getResponse()
Return the Response with which this Request is associated. |
java.lang.String |
getScheme()
Return the scheme used to make this Request. |
java.lang.String |
getServerName()
Return the server name responding to this Request. |
int |
getServerPort()
Return the server port responding to this Request. |
java.lang.String |
getServletPath()
Return the portion of the request URI used to select the servlet that will process this request. |
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. |
java.net.Socket |
getSocket()
Return the Socket (if any) through which this Request was received. |
java.io.InputStream |
getStream()
Return the input stream associated with this Request. |
protected B2CConverter |
getURIConverter()
Return the URI converter. |
java.security.Principal |
getUserPrincipal()
Return the principal that has been authenticated for this Request. |
Wrapper |
getWrapper()
Return the Wrapper within which this Request is being processed. |
boolean |
isRequestedSessionIdFromCookie()
Return true if the session identifier included in this
request came from a cookie. |
boolean |
isRequestedSessionIdFromUrl()
Deprecated. As of Version 2.1 of the Java Servlet API, use isRequestedSessionIdFromURL() instead. |
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(java.lang.String role)
Return true if the authenticated user principal
possesses the specified role name. |
protected void |
parseLocales()
Parse request locales. |
protected void |
parseLocalesHeader(java.lang.String value)
Parse accept-language header value. |
protected void |
parseRequestParameters()
Parse request parameters. |
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(java.lang.String name)
Remove the specified request attribute if it exists. |
void |
removeNote(java.lang.String name)
Remove any object bound to the specified name in the internal notes for this request. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set the specified request attribute to the specified value. |
void |
setAuthorization(java.lang.String authorization)
Set the authorization credentials sent with this request. |
void |
setAuthType(java.lang.String type)
Set the authentication type used for this request, if any; otherwise set the type to null . |
void |
setCharacterEncoding(java.lang.String enc)
Overrides the name of the character encoding used in the body of this request. |
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(java.lang.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(java.lang.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(java.lang.String uri)
Set the decoded request URI. |
void |
setMethod(java.lang.String method)
Set the HTTP request method used for this Request. |
void |
setNote(java.lang.String name,
java.lang.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(java.lang.String path)
Set the path information for this Request. |
void |
setProtocol(java.lang.String protocol)
Set the protocol name and version associated with this Request. |
void |
setQueryString(java.lang.String query)
Set the query string for this Request. |
void |
setRemoteAddr(java.lang.String remoteAddr)
Set the IP address of the remote client associated with this Request. |
void |
setRemoteHost(java.lang.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(java.lang.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(java.lang.String uri)
Set the unparsed request URI for this Request. |
void |
setResponse(org.apache.catalina.Response response)
Set the Response with which this Request is associated. |
void |
setScheme(java.lang.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(java.lang.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(java.lang.String path)
Set the servlet path for this Request. |
void |
setSocket(java.net.Socket socket)
Set the Socket (if any) through which this Request was received. |
void |
setStream(java.io.InputStream stream)
Set the input stream associated with this Request. |
protected void |
setURIConverter(B2CConverter URIConverter)
Set the URI converter. |
void |
setUserPrincipal(java.security.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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Request coyoteRequest
protected static StringManager sm
protected Cookie[] cookies
protected java.text.SimpleDateFormat[] formats
protected static java.util.Locale defaultLocale
protected java.util.HashMap attributes
protected java.util.ArrayList locales
protected java.lang.String authType
protected java.io.BufferedReader reader
protected CoyoteInputStream inputStream
protected boolean usingInputStream
protected boolean usingReader
protected java.lang.String contextPath
protected java.lang.String pathInfo
protected java.lang.String servletPath
protected java.security.Principal userPrincipal
protected boolean sessionParsed
protected boolean requestParametersParsed
protected boolean secure
protected static int CACHED_POST_LEN
protected byte[] postData
protected ParameterMap parameterMap
protected Session session
protected boolean requestedSessionCookie
protected java.lang.String requestedSessionId
protected boolean requestedSessionURL
protected java.net.Socket socket
protected boolean localesParsed
protected java.lang.String remoteAddr
protected java.lang.String remoteHost
protected java.lang.String authorization
protected CoyoteConnector connector
protected Context context
protected static final java.lang.String info
protected CoyoteRequestFacade facade
protected org.apache.catalina.Response response
protected B2CConverter URIConverter
protected Wrapper wrapper
Constructor Detail |
public CoyoteRequest()
Method Detail |
public void setCoyoteRequest(Request coyoteRequest)
coyoteRequest
- The Coyote requestpublic Request getCoyoteRequest()
public void recycle()
public java.lang.String getAuthorization()
public void setAuthorization(java.lang.String authorization)
authorization
- The new authorization credentialspublic Connector getConnector()
public void setConnector(Connector connector)
connector
- The new connectorpublic Context getContext()
public void setContext(Context context)
getContextPath()
,
and thus enables parsing of the request URI.
context
- The newly associated Contextpublic java.lang.String getInfo()
<description>/<version>
.
public ServletRequest getRequest()
ServletRequest
for which this object
is the facade. This method must be implemented by a subclass.
public org.apache.catalina.Response getResponse()
public void setResponse(org.apache.catalina.Response response)
response
- The new associated responsepublic java.net.Socket getSocket()
public void setSocket(java.net.Socket socket)
socket
- The socket through which this request was receivedpublic java.io.InputStream getStream()
public void setStream(java.io.InputStream stream)
stream
- The new input streamprotected B2CConverter getURIConverter()
protected void setURIConverter(B2CConverter URIConverter)
URIConverter
- the new URI connverterpublic Wrapper getWrapper()
public void setWrapper(Wrapper wrapper)
wrapper
- The newly associated Wrapperpublic ServletInputStream createInputStream() throws java.io.IOException
java.io.IOException
- if an input/output error occurspublic void finishRequest() throws java.io.IOException
java.io.IOException
- if an input/output error occurspublic java.lang.Object getNote(java.lang.String name)
null
if no such binding exists.
name
- Name of the note to be returnedpublic java.util.Iterator getNoteNames()
public void removeNote(java.lang.String name)
name
- Name of the note to be removedpublic void setNote(java.lang.String name, java.lang.Object value)
name
- Name to which the object should be boundvalue
- Object to be bound to the specified namepublic void setContentLength(int length)
length
- The new content lengthpublic void setContentType(java.lang.String type)
text/html; charset=ISO-8859-4
.
type
- The new content typepublic void setProtocol(java.lang.String protocol)
protocol
- Protocol name and versionpublic void setRemoteAddr(java.lang.String remoteAddr)
remoteAddr
- The remote IP addresspublic void setRemoteHost(java.lang.String remoteHost)
remoteHost
- The remote host namepublic void setScheme(java.lang.String scheme)
http
, https
, and ftp
.
scheme
- The schemepublic void setSecure(boolean secure)
isSecure()
for this Request.
secure
- The new isSecure valuepublic void setServerName(java.lang.String name)
name
- The server namepublic void setServerPort(int port)
port
- The server portpublic java.lang.Object getAttribute(java.lang.String name)
null
.
name
- Name of the request attribute to returnpublic java.util.Enumeration getAttributeNames()
Enumeration
if there are none.
public java.lang.String getCharacterEncoding()
public int getContentLength()
public java.lang.String getContentType()
public ServletInputStream getInputStream() throws java.io.IOException
createInputStream()
.
java.lang.IllegalStateException
- if getReader()
has
already been called for this request
java.io.IOException
- if an input/output error occurspublic java.util.Locale getLocale()
Accept-Language
header
that was encountered. If the request did not specify a preferred
language, the server's default Locale is returned.
public java.util.Enumeration getLocales()
Accept-Language
headers that were encountered. If the request did not specify a
preferred language, the server's default Locale is returned.
public java.lang.String getParameter(java.lang.String name)
null
. If there is more than one value defined,
return only the first one.
name
- Name of the desired request parameterpublic java.util.Map getParameterMap()
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.
Map
containing parameter names as keys
and parameter values as map values.public java.util.Enumeration getParameterNames()
public java.lang.String[] getParameterValues(java.lang.String name)
null
.
name
- Name of the desired request parameterpublic java.lang.String getProtocol()
public java.io.BufferedReader getReader() throws java.io.IOException
BufferedReader
around the
servlet input stream returned by createInputStream()
.
java.lang.IllegalStateException
- if getInputStream()
has already been called for this request
java.io.IOException
- if an input/output error occurspublic java.lang.String getRealPath(java.lang.String path)
ServletContext.getRealPath()
.
path
- Path to be translatedpublic java.lang.String getRemoteAddr()
public java.lang.String getRemoteHost()
public RequestDispatcher getRequestDispatcher(java.lang.String path)
path
- Path of the resource to be wrappedpublic java.lang.String getScheme()
public java.lang.String getServerName()
public int getServerPort()
public boolean isSecure()
public void removeAttribute(java.lang.String name)
name
- Name of the request attribute to removepublic void setAttribute(java.lang.String name, java.lang.Object value)
name
- Name of the request attribute to setvalue
- The associated valuepublic void setCharacterEncoding(java.lang.String enc) throws java.io.UnsupportedEncodingException
getReader()
.
enc
- The character encoding to be used
java.io.UnsupportedEncodingException
- if the specified encoding
is not supportedpublic void addCookie(Cookie cookie)
cookie
- The new cookiepublic void addHeader(java.lang.String name, java.lang.String value)
name
- The new header namevalue
- The new header valuepublic void addLocale(java.util.Locale locale)
locale
- The new preferred Localepublic void addParameter(java.lang.String name, java.lang.String[] values)
name
- Name of this request parametervalues
- Corresponding values for this request parameterpublic void clearCookies()
public void clearHeaders()
public void clearLocales()
public void clearParameters()
public void setAuthType(java.lang.String type)
null
. Typical values are "BASIC",
"DIGEST", or "SSL".
type
- The authentication type usedpublic void setContextPath(java.lang.String path)
path
- The context pathpublic void setMethod(java.lang.String method)
method
- The request methodpublic void setQueryString(java.lang.String query)
query
- The query stringpublic void setPathInfo(java.lang.String path)
path
- The path informationpublic void setRequestedSessionCookie(boolean flag)
flag
- The new flagpublic void setRequestedSessionId(java.lang.String id)
id
- The new session idpublic void setRequestedSessionURL(boolean flag)
flag
- The new flagpublic void setRequestURI(java.lang.String uri)
uri
- The request URIpublic void setDecodedRequestURI(java.lang.String uri)
uri
- The decoded request URIpublic java.lang.String getDecodedRequestURI()
public void setServletPath(java.lang.String path)
path
- The servlet pathpublic void setUserPrincipal(java.security.Principal principal)
getRemoteUser()
method.
principal
- The user Principalpublic java.lang.String getAuthType()
public java.lang.String getContextPath()
public Cookie[] getCookies()
public void setCookies(Cookie[] cookies)
public long getDateHeader(java.lang.String name)
name
- Name of the requested date header
java.lang.IllegalArgumentException
- if the specified header value
cannot be converted to a datepublic java.lang.String getHeader(java.lang.String name)
null
name
- Name of the requested headerpublic java.util.Enumeration getHeaders(java.lang.String name)
name
- Name of the requested headerpublic java.util.Enumeration getHeaderNames()
public int getIntHeader(java.lang.String name)
name
- Name of the requested header
java.lang.IllegalArgumentException
- if the specified header value
cannot be converted to an integerpublic java.lang.String getMethod()
public java.lang.String getPathInfo()
public java.lang.String getPathTranslated()
public java.lang.String getQueryString()
public java.lang.String getRemoteUser()
public java.lang.String getRequestedSessionId()
public java.lang.String getRequestURI()
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 java.lang.String getServletPath()
public HttpSession getSession()
public HttpSession getSession(boolean create)
create
- Create a new session if one does not existpublic boolean isRequestedSessionIdFromCookie()
true
if the session identifier included in this
request came from a cookie.
public boolean isRequestedSessionIdFromURL()
true
if the session identifier included in this
request came from the request URI.
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromURL()
instead.
true
if the session identifier included in this
request came from the request URI.
public boolean isRequestedSessionIdValid()
true
if the session identifier included in this
request identifies a valid session.
public boolean isUserInRole(java.lang.String role)
true
if the authenticated user principal
possesses the specified role name.
role
- Role name to be validatedpublic java.security.Principal getUserPrincipal()
protected HttpSession doGetSession(boolean create)
protected void parseRequestParameters()
protected int readPostBody(byte[] body, int len) throws java.io.IOException
java.io.IOException
protected void parseLocales()
protected void parseLocalesHeader(java.lang.String value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |