|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.catalina.connector.RequestBase | +--org.apache.catalina.connector.HttpRequestBase
Convenience base implementation of the HttpRequest interface, which can be used for the Request implementation required by most Connectors that implement the HTTP protocol. Only the connector-specific methods need to be implemented.
Inner Class Summary | |
protected class |
HttpRequestBase.PrivilegedGetSession
|
Field Summary | |
protected java.lang.String |
authType
The authentication type used for this request. |
protected java.lang.String |
contextPath
The context path for this request. |
protected java.util.ArrayList |
cookies
The set of cookies associated with this Request. |
protected static java.util.ArrayList |
empty
An empty collection to use for returning empty Enumerations. |
protected HttpRequestFacade |
facade
The facade associated with this request. |
protected java.text.SimpleDateFormat[] |
formats
The set of SimpleDateFormat formats to use in getDateHeader(). |
protected java.util.HashMap |
headers
The HTTP headers associated with this Request, keyed by name. |
protected static java.lang.String |
info
Descriptive information about this HttpRequest implementation. |
protected java.lang.String |
method
The request method associated with this Request. |
protected ParameterMap |
parameters
The parsed parameters for this request. |
protected boolean |
parsed
Have the parameters for this request been parsed yet? |
protected java.lang.String |
pathInfo
The path information for this request. |
protected java.lang.String |
queryString
The query string for this request. |
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 java.lang.String |
requestURI
The request URI associated with this request. |
protected boolean |
secure
Was this request received on a secure channel? |
protected java.lang.String |
servletPath
The servlet path for this request. |
protected Session |
session
The currently active session for this request. |
protected java.security.Principal |
userPrincipal
The Principal who has been authenticated for this Request. |
Fields inherited from class org.apache.catalina.connector.RequestBase |
attributes,
authorization,
characterEncoding,
connector,
contentLength,
contentType,
context,
defaultLocale,
facade,
info,
input,
locales,
protocol,
reader,
remoteAddr,
remoteHost,
response,
scheme,
secure,
serverName,
serverPort,
sm,
socket,
stream,
wrapper |
Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH,
CLIENT_CERT_AUTH,
DIGEST_AUTH,
FORM_AUTH |
Constructor Summary | |
HttpRequestBase()
|
Method Summary | |
void |
addCookie(javax.servlet.http.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 |
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. |
java.lang.String |
getAuthType()
Return the authentication type used for this Request. |
java.lang.String |
getContextPath()
Return the portion of the request URI used to select the Context of the Request. |
javax.servlet.http.Cookie[] |
getCookies()
Return the set of Cookies received with this Request. |
long |
getDateHeader(java.lang.String name)
Return the value of the specified date header, if any; otherwise return -1. |
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> . |
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.lang.String |
getMethod()
Return the HTTP request method used in 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 |
getQueryString()
Return the query string associated with this request. |
java.lang.String |
getRemoteUser()
Return the name of the remote user that has been authenticated for this Request. |
javax.servlet.ServletRequest |
getRequest()
Return the ServletRequest for which this object
is the facade. |
javax.servlet.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. |
java.lang.String |
getServletPath()
Return the portion of the request URI used to select the servlet that will process this request. |
javax.servlet.http.HttpSession |
getSession()
Return the session associated with this Request, creating one if necessary. |
javax.servlet.http.HttpSession |
getSession(boolean create)
Return the session associated with this Request, creating one if necessary and requested. |
java.security.Principal |
getUserPrincipal()
Return the principal that has been authenticated for this Request. |
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 |
parseParameters()
Parse the parameters of this request, if it has not already occurred. |
void |
recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object. |
void |
setAuthType(java.lang.String authType)
Set the authentication type used for this request, if any; otherwise set the type to null . |
void |
setContextPath(java.lang.String path)
Set the context path for this Request. |
void |
setMethod(java.lang.String method)
Set the HTTP request method used for this Request. |
void |
setPathInfo(java.lang.String path)
Set the path information for this Request. |
void |
setQueryString(java.lang.String query)
Set the query string for 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 |
setSecure(boolean secure)
Set the flag indicating whether this Request was received on a secure communications link or not. |
void |
setServletPath(java.lang.String path)
Set the servlet path for this Request. |
void |
setUserPrincipal(java.security.Principal principal)
Set the Principal who has been authenticated for this Request. |
Methods inherited from class org.apache.catalina.connector.RequestBase |
addLocale,
createInputStream,
finishRequest,
getAttribute,
getAttributeNames,
getAuthorization,
getCharacterEncoding,
getConnector,
getContentLength,
getContentType,
getContext,
getInputStream,
getLocale,
getLocales,
getNote,
getNoteNames,
getProtocol,
getReader,
getRealPath,
getRemoteAddr,
getRemoteHost,
getResponse,
getScheme,
getServerName,
getServerPort,
getSocket,
getStream,
getWrapper,
removeAttribute,
removeNote,
setAttribute,
setAuthorization,
setCharacterEncoding,
setConnector,
setContentLength,
setContentType,
setContext,
setNote,
setProtocol,
setRemoteAddr,
setRemoteHost,
setResponse,
setScheme,
setServerName,
setServerPort,
setSocket,
setStream,
setWrapper |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.lang.String authType
protected java.lang.String contextPath
protected java.util.ArrayList cookies
protected static java.util.ArrayList empty
protected java.text.SimpleDateFormat[] formats
protected HttpRequestFacade facade
protected java.util.HashMap headers
protected static final java.lang.String info
protected java.lang.String method
protected ParameterMap parameters
getParameter()
family of method calls. The key is the
parameter name, while the value is a String array of values for this
parameter.
IMPLEMENTATION NOTE - Once the parameters for a particular request are parsed and stored here, they are not modified. Therefore, application level access to the parameters need not be synchronized.
protected boolean parsed
protected java.lang.String pathInfo
protected java.lang.String queryString
protected boolean requestedSessionCookie
protected java.lang.String requestedSessionId
protected boolean requestedSessionURL
protected java.lang.String requestURI
protected boolean secure
protected java.lang.String servletPath
protected Session session
protected java.security.Principal userPrincipal
Constructor Detail |
public HttpRequestBase()
Method Detail |
public java.lang.String getInfo()
<description>/<version>
.public javax.servlet.ServletRequest getRequest()
ServletRequest
for which this object
is the facade. This method must be implemented by a subclass.public void addCookie(javax.servlet.http.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 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 recycle()
public void setAuthType(java.lang.String authType)
null
. Typical values are "BASIC",
"DIGEST", or "SSL".authType
- 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 setPathInfo(java.lang.String path)
path
- The path informationpublic void setQueryString(java.lang.String query)
query
- The query stringpublic 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 setSecure(boolean secure)
secure
- The new secure flagpublic void setServletPath(java.lang.String path)
path
- The servlet pathpublic void setUserPrincipal(java.security.Principal principal)
getRemoteUser()
method.principal
- The user Principalprotected void parseParameters()
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 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
path
- Path of the resource to be wrappedpublic boolean isSecure()
public java.lang.String getAuthType()
public java.lang.String getContextPath()
public javax.servlet.http.Cookie[] getCookies()
public long getDateHeader(java.lang.String name)
name
- Name of the requested date headerpublic 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 headerpublic 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 javax.servlet.http.HttpSession getSession()
public javax.servlet.http.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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |