Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.coyote.tomcat5.CoyoteRequest
Field Summary | |
protected static int |
|
protected B2CConverter |
|
protected HashMap |
|
protected String |
|
protected CoyoteConnector |
|
protected Context |
|
protected Cookie[] |
|
protected boolean |
|
protected Request |
|
protected static Locale |
|
protected Object |
|
protected CoyoteRequestFacade |
|
protected FilterChain |
|
protected SimpleDateFormat[] |
|
protected static String |
|
protected InputBuffer |
|
protected CoyoteInputStream |
|
protected String |
|
protected String |
|
protected int |
|
protected ArrayList |
|
protected boolean |
|
protected Log |
|
protected MappingData |
|
protected ParameterMap |
|
protected byte[] | |
protected CoyoteReader |
|
protected String |
|
protected String |
|
protected int |
|
protected Object |
|
protected boolean |
|
protected boolean |
|
protected String |
|
protected boolean |
|
protected Response |
|
protected boolean |
|
protected Session |
|
protected boolean |
|
protected static StringManager |
|
protected Socket |
|
protected Subject |
|
protected Principal |
|
protected boolean |
|
protected boolean |
|
protected ValveContext |
|
protected Wrapper |
|
Constructor Summary | |
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
ServletInputStream |
|
protected HttpSession |
|
void |
|
Object |
|
Enumeration |
|
String |
|
String |
|
String |
|
Connector |
|
int |
|
String |
|
Context |
|
String |
|
MessageBytes |
|
Cookie[] |
|
Request |
|
long |
|
String |
|
MessageBytes |
|
FilterChain |
|
String |
|
Enumeration |
|
Enumeration |
|
Host |
|
String |
|
ServletInputStream |
|
int |
|
String |
|
String |
|
int |
|
Locale |
|
Enumeration |
|
MappingData |
|
String |
|
Object |
|
Iterator |
|
String |
|
Map |
|
Enumeration |
|
String[] |
|
String |
|
MessageBytes |
|
String |
|
String |
|
String |
|
BufferedReader |
|
String |
|
String |
|
String |
|
int |
|
String |
|
ServletRequest |
|
RequestDispatcher |
|
MessageBytes |
|
String |
|
StringBuffer |
|
String |
|
Response |
|
String |
|
String |
|
int |
|
String |
|
MessageBytes |
|
HttpSession |
|
HttpSession |
|
Socket |
|
InputStream |
|
protected B2CConverter |
|
Principal |
|
ValveContext |
|
Wrapper |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
void |
|
void |
|
void |
|
protected static int CACHED_POST_LEN
Post data buffer.
protected HashMap attributes
The attributes associated with this Request, keyed by attribute name.
protected String authType
Authentication type.
protected Cookie[] cookies
The set of cookies associated with this Request.
protected boolean cookiesParsed
Cookies parsed flag.
protected static Locale defaultLocale
The default Locale if none are specified.
protected Object dispatcherType
The current dispatcher type.
protected FilterChain filterChain
Filter chain associated with the request.
protected SimpleDateFormat[] formats
The set of SimpleDateFormat formats to use in getDateHeader().
protected static final String info
Descriptive information about this Request implementation.
protected String localAddr
Local address
protected String localName
Local address
protected int localPort
Local port
protected ArrayList locales
The preferred Locales assocaited with this Request.
protected boolean localesParsed
Parse locales.
protected Log log
After the request is mapped to a ServletContext, we can also map it to a logger.
protected byte[] postData
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 requestParametersParsed
Request parameters parsed flag.
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 boolean secure
Secure flag.
protected boolean sessionParsed
Session parsed flag.
protected Socket socket
The socket through which this Request was received.
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.
public void addCookie(Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request.
- Specified by:
- addCookie in interface HttpRequest
- Parameters:
cookie
- The new cookie
public void addHeader(String name, String value)
Add a Header to the set of Headers associated with this Request.
- Specified by:
- addHeader in interface HttpRequest
- Parameters:
name
- The new header namevalue
- The new header value
public void addLocale(Locale locale)
Add a Locale to the set of preferred Locales for this Request. The first added Locale will be the first one returned by getLocales().
- Specified by:
- addLocale in interface HttpRequest
- Parameters:
locale
- The new preferred Locale
public void addParameter(String name, values[] )
Add a parameter name and corresponding set of values to this Request. (This is used when restoring the original request on a form based login).
- Specified by:
- addParameter in interface HttpRequest
- Parameters:
name
- Name of this request parameter
public void clearCookies()
Clear the collection of Cookies associated with this Request.
- Specified by:
- clearCookies in interface HttpRequest
public void clearHeaders()
Clear the collection of Headers associated with this Request.
- Specified by:
- clearHeaders in interface HttpRequest
public void clearLocales()
Clear the collection of Locales associated with this Request.
- Specified by:
- clearLocales in interface HttpRequest
public void clearParameters()
Clear the collection of parameters associated with this Request.
- Specified by:
- clearParameters in interface HttpRequest
protected void configureSessionCookie(Cookie cookie)
Configures the given JSESSIONID cookie.
- Parameters:
cookie
- The JSESSIONID cookie to be configured
public ServletInputStream createInputStream() throws IOException
Create and return a ServletInputStream to read the content associated with this Request.
- Specified by:
- createInputStream in interface Request
protected HttpSession doGetSession(boolean create)
public void finishRequest() throws IOException
Perform whatever actions are required to flush and close the input stream or reader, in a single operation.
- Specified by:
- finishRequest in interface Request
public Object getAttribute(String name)
Return the specified request attribute if it exists; otherwise, returnnull
.
- Parameters:
name
- Name of the request attribute to return
public Enumeration getAttributeNames()
Return the names of all request attributes for this Request, or an emptyEnumeration
if there are none.
public String getAuthType()
Return the authentication type used for this Request.
public String getAuthorization()
Return the authorization credentials sent with this request.
- Specified by:
- getAuthorization in interface Request
public String getCharacterEncoding()
Return the character encoding for this Request.
public Connector getConnector()
Return the Connector through which this Request was received.
- Specified by:
- getConnector in interface Request
public int getContentLength()
Return the content length for this Request.
public String getContentType()
Return the content type for this Request.
public Context getContext()
Return the Context within which this Request is being processed.
- Specified by:
- getContext in interface Request
public String getContextPath()
Return the portion of the request URI used to select the Context of the Request.
public MessageBytes getContextPathMB()
Get the context path.
- Specified by:
- getContextPathMB in interface HttpRequest
- Returns:
- the context path
public Cookie[] getCookies()
Return the set of Cookies received with this Request.
public long getDateHeader(String name)
Return the value of the specified date header, if any; otherwise return -1.
- Parameters:
name
- Name of the requested date header
public String getDecodedRequestURI()
Get the decoded request URI.
- Specified by:
- getDecodedRequestURI in interface HttpRequest
- Returns:
- the URL decoded request URI
public MessageBytes getDecodedRequestURIMB()
Get the decoded request URI.
- Specified by:
- getDecodedRequestURIMB in interface HttpRequest
- Returns:
- the URL decoded request URI
public FilterChain getFilterChain()
Get filter chain associated with the request.
- Specified by:
- getFilterChain in interface Request
public String getHeader(String name)
Return the first value of the specified header, if any; otherwise, returnnull
- Parameters:
name
- Name of the requested header
public Enumeration getHeaderNames()
Return the names of all headers received with this request.
public Enumeration getHeaders(String name)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
- Parameters:
name
- Name of the requested header
public String getInfo()
Return descriptive information about this Request implementation and the corresponding version number, in the format<description>/<version>
.
public ServletInputStream getInputStream() throws IOException
Return the servlet input stream for this Request. The default implementation returns a servlet input stream created bycreateInputStream()
.
public 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.
- Parameters:
name
- Name of the requested header
public String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.
public String getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
public Locale getLocale()
Return the preferred Locale that the client will accept content in, based on the value for the firstAccept-Language
header that was encountered. If the request did not specify a preferred language, the server's default Locale is returned.
public Enumeration getLocales()
Return the set of preferred Locales that the client will accept content in, based on the values for anyAccept-Language
headers that were encountered. If the request did not specify a preferred language, the server's default Locale is returned.
public String getMethod()
Return the HTTP request method used in this Request.
public Object getNote(String name)
Return the object bound with the specified name to the internal notes for this request, ornull
if no such binding exists.
- Parameters:
name
- Name of the note to be returned
public Iterator getNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this request.
- Specified by:
- getNoteNames in interface Request
public String getParameter(String name)
Return the value of the specified request parameter, if any; otherwise, returnnull
. If there is more than one value defined, return only the first one.
- Parameters:
name
- Name of the desired request parameter
public Map getParameterMap()
Returns aMap
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.
public Enumeration getParameterNames()
Return the names of all defined request parameters for this request.
public String[] getParameterValues(String name)
Return the defined values for the specified request parameter, if any; otherwise, returnnull
.
- Parameters:
name
- Name of the desired request parameter
public String getPathInfo()
Return the path information associated with this Request.
public MessageBytes getPathInfoMB()
Get the path info.
- Specified by:
- getPathInfoMB in interface HttpRequest
- Returns:
- the path info
public String getPathTranslated()
Return the extra path information for this request, translated to a real path.
public String getProtocol()
Return the protocol and version used to make this Request.
public String getQueryString()
Return the query string associated with this request.
public BufferedReader getReader() throws IOException
Read the Reader wrapping the input stream for this Request. The default implementation wraps aBufferedReader
around the servlet input stream returned bycreateInputStream()
.
public String getRealPath(String path)
Deprecated. As of version 2.1 of the Java Servlet API, use
ServletContext.getRealPath()
.Return the real path of the specified virtual path.
- Parameters:
path
- Path to be translated
public String getRemoteAddr()
Return the remote IP address making this Request.
public String getRemoteHost()
Return the remote host name making this Request.
public int getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
public String getRemoteUser()
Return the name of the remote user that has been authenticated for this Request.
public ServletRequest getRequest()
Return theServletRequest
for which this object is the facade. This method must be implemented by a subclass.
- Specified by:
- getRequest in interface Request
public 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.
- Parameters:
path
- Path of the resource to be wrapped
public MessageBytes getRequestPathMB()
Get the request path.
- Specified by:
- getRequestPathMB in interface HttpRequest
- Returns:
- the request path
public String getRequestURI()
Return the request URI for this request.
public 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 aStringBuffer
, not aString
, 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
public String getRequestedSessionId()
Return the session identifier included in this request, if any.
public Response getResponse()
Return the Response with which this Request is associated.
- Specified by:
- getResponse in interface Request
public String getScheme()
Return the scheme used to make this Request.
public String getServerName()
Return the server name responding to this Request.
public int getServerPort()
Return the server port responding to this Request.
public String getServletPath()
Return the portion of the request URI used to select the servlet that will process this request.
public MessageBytes getServletPathMB()
Get the servlet path.
- Specified by:
- getServletPathMB in interface HttpRequest
- Returns:
- the servlet path
public HttpSession getSession()
Return the session associated with this Request, creating one if necessary.
public HttpSession getSession(boolean create)
Return the session associated with this Request, creating one if necessary and requested.
- Parameters:
create
- Create a new session if one does not exist
public Socket getSocket()
Return the Socket (if any) through which this Request was received. This should only be used to access underlying state information about this Socket, such as the SSLSession associated with an SSLSocket.
public InputStream getStream()
Return the input stream associated with this Request.
public Principal getUserPrincipal()
Return the principal that has been authenticated for this Request.
public ValveContext getValveContext()
Get valve context.
- Specified by:
- getValveContext in interface Request
public Wrapper getWrapper()
Return the Wrapper within which this Request is being processed.
- Specified by:
- getWrapper in interface Request
public boolean isRequestedSessionIdFromCookie()
Returntrue
if the session identifier included in this request came from a cookie.
public boolean isRequestedSessionIdFromURL()
Returntrue
if the session identifier included in this request came from the request URI.
public boolean isRequestedSessionIdFromUrl()
Deprecated. As of Version 2.1 of the Java Servlet API, use
isRequestedSessionIdFromURL()
instead.Returntrue
if the session identifier included in this request came from the request URI.
public boolean isRequestedSessionIdValid()
Returntrue
if the session identifier included in this request identifies a valid session.
public boolean isSecure()
Was this request received on a secure connection?
public boolean isUserInRole(String role)
Returntrue
if the authenticated user principal possesses the specified role name.
- Parameters:
role
- Role name to be validated
protected void parseCookies()
Parse cookies.
protected void parseLocales()
Parse request locales.
protected void parseLocalesHeader(String value)
Parse accept-language header value.
protected void parseRequestParameters()
Parse request parameters.
protected int readPostBody(body[] , int len) throws IOException
Read post body in an array.
public void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.
public void removeAttribute(String name)
Remove the specified request attribute if it exists.
- Parameters:
name
- Name of the request attribute to remove
public void removeNote(String name)
Remove any object bound to the specified name in the internal notes for this request.
- Specified by:
- removeNote in interface Request
- Parameters:
name
- Name of the note to be removed
public void setAttribute(String name, Object value)
Set the specified request attribute to the specified value.
- Parameters:
name
- Name of the request attribute to setvalue
- The associated value
public void setAuthType(String type)
Set the authentication type used for this request, if any; otherwise set the type tonull
. Typical values are "BASIC", "DIGEST", or "SSL".
- Specified by:
- setAuthType in interface HttpRequest
- Parameters:
type
- The authentication type used
public void setAuthorization(String authorization)
Set the authorization credentials sent with this request.
- Specified by:
- setAuthorization in interface Request
- Parameters:
authorization
- The new authorization credentials
public void setCharacterEncoding(String enc) throws UnsupportedEncodingException
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input usinggetReader()
.
- Parameters:
enc
- The character encoding to be used
- Since:
- Servlet 2.3
public void setConnector(Connector connector)
Set the Connector through which this Request was received.
- Specified by:
- setConnector in interface Request
- Parameters:
connector
- The new connector
public void setContentLength(int length)
Set the content length associated with this Request.
- Specified by:
- setContentLength in interface Request
- Parameters:
length
- The new content length
public void setContentType(String type)
Set the content type (and optionally the character encoding) associated with this Request. For example,text/html; charset=ISO-8859-4
.
- Specified by:
- setContentType in interface Request
- Parameters:
type
- The new content type
public void setContext(Context context)
Set the Context within which this Request is being processed. This must be called as soon as the appropriate Context is identified, because it identifies the value to be returned bygetContextPath()
, and thus enables parsing of the request URI.
- Specified by:
- setContext in interface Request
- Parameters:
context
- The newly associated Context
public void setContextPath(String path)
Set the context path for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
- Specified by:
- setContextPath in interface HttpRequest
- Parameters:
path
- The context path
public void setCookies(Cookie[] cookies)
Set the set of cookies recieved with this Request.
public void setCoyoteRequest(Request coyoteRequest)
Set the Coyote request.
- Parameters:
coyoteRequest
- The Coyote request
public void setDecodedRequestURI(String uri)
Set the decoded request URI.
- Specified by:
- setDecodedRequestURI in interface HttpRequest
- Parameters:
uri
- The decoded request URI
public void setFilterChain(FilterChain filterChain)
Set filter chain associated with the request.
- Specified by:
- setFilterChain in interface Request
- Parameters:
filterChain
- new filter chain
public void setHost(Host host)
Set the Host within which this Request is being processed. This must be called as soon as the appropriate Host is identified, and before the Request is passed to a context.
- Parameters:
host
- The newly associated Host
public void setMethod(String method)
Set the HTTP request method used for this Request.
- Specified by:
- setMethod in interface HttpRequest
- Parameters:
method
- The request method
public 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.
- Parameters:
name
- Name to which the object should be boundvalue
- Object to be bound to the specified name
public void setPathInfo(String path)
Set the path information for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
- Specified by:
- setPathInfo in interface HttpRequest
- Parameters:
path
- The path information
public void setProtocol(String protocol)
Set the protocol name and version associated with this Request.
- Specified by:
- setProtocol in interface Request
- Parameters:
protocol
- Protocol name and version
public void setQueryString(String query)
Set the query string for this Request. This will normally be called by the HTTP Connector, when it parses the request headers.
- Specified by:
- setQueryString in interface HttpRequest
- Parameters:
query
- The query string
public void setRemoteAddr(String remoteAddr)
Set the IP address of the remote client associated with this Request.
- Specified by:
- setRemoteAddr in interface Request
- Parameters:
remoteAddr
- The remote IP address
public void setRemoteHost(String remoteHost)
Set the fully qualified name of the remote client associated with this Request.
- Parameters:
remoteHost
- The remote host name
public void setRequestURI(String uri)
Set the unparsed request URI for this Request. This will normally be called by the HTTP Connector, when it parses the request headers.
- Specified by:
- setRequestURI in interface HttpRequest
- Parameters:
uri
- The request URI
public void setRequestedSessionCookie(boolean flag)
Set a flag indicating whether or not the requested session ID for this request came in through a cookie. This is normally called by the HTTP Connector, when it parses the request headers.
- Specified by:
- setRequestedSessionCookie in interface HttpRequest
- Parameters:
flag
- The new flag
public void setRequestedSessionId(String id)
Set the requested session ID for this request. This is normally called by the HTTP Connector, when it parses the request headers.
- Specified by:
- setRequestedSessionId in interface HttpRequest
- Parameters:
id
- The new session id
public void setRequestedSessionURL(boolean flag)
Set a flag indicating whether or not the requested session ID for this request came in through a URL. This is normally called by the HTTP Connector, when it parses the request headers.
- Specified by:
- setRequestedSessionURL in interface HttpRequest
- Parameters:
flag
- The new flag
public void setResponse(Response response)
Set the Response with which this Request is associated.
- Specified by:
- setResponse in interface Request
- Parameters:
response
- The new associated response
public void setScheme(String scheme)
Set the name of the scheme associated with this request. Typical values arehttp
,https
, andftp
.
- Parameters:
scheme
- The scheme
public void setSecure(boolean secure)
Set the value to be returned byisSecure()
for this Request.
- Parameters:
secure
- The new isSecure value
public void setServerName(String name)
Set the name of the server (virtual host) to process this request.
- Specified by:
- setServerName in interface Request
- Parameters:
name
- The server name
public void setServerPort(int port)
Set the port number of the server to process this request.
- Specified by:
- setServerPort in interface Request
- Parameters:
port
- The server port
public void setServletPath(String path)
Set the servlet path for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
- Specified by:
- setServletPath in interface HttpRequest
- Parameters:
path
- The servlet path
public void setSocket(Socket socket)
Set the Socket (if any) through which this Request was received.
- Parameters:
socket
- The socket through which this request was received
public void setStream(InputStream stream)
Set the input stream associated with this Request.
- Parameters:
stream
- The new input stream
protected void setURIConverter(B2CConverter URIConverter)
Set the URI converter.
- Parameters:
URIConverter
- the new URI connverter
public void setUserPrincipal(Principal principal)
Set the Principal who has been authenticated for this Request. This value is also used to calculate the value to be returned by thegetRemoteUser()
method.
- Specified by:
- setUserPrincipal in interface HttpRequest
- Parameters:
principal
- The user Principal
public void setValveContext(ValveContext valveContext)
Set valve context.
- Specified by:
- setValveContext in interface Request
- Parameters:
valveContext
- New valve context object
public void setWrapper(Wrapper wrapper)
Set the Wrapper within which this Request is being processed. This must be called as soon as the appropriate Wrapper is identified, and before the Request is ultimately passed to an application servlet.
- Specified by:
- setWrapper in interface Request
- Parameters:
wrapper
- The newly associated Wrapper