Overview Package Class Tree Deprecated Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
org.apache.coyote.tomcat4
Class CoyoteRequestjava.lang.Object org.apache.coyote.tomcat4.CoyoteRequest
- All Implemented Interfaces:
- HttpRequest, javax.servlet.http.HttpServletRequest, Request, javax.servlet.ServletRequest
- public class CoyoteRequest
- extends java.lang.Object
- implements HttpRequest, javax.servlet.http.HttpServletRequest
Wrapper object for the Coyote request.
- Version:
- $Revision: 1.37 $ $Date: 2004/02/24 08:54:29 $
- Author:
- Remy Maucherat, Craig R. McClanahan
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 javax.servlet.http.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 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.
Fields inherited from interface javax.servlet.http.HttpServletRequest BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
Constructor Summary CoyoteRequest()
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 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.javax.servlet.ServletInputStream createInputStream()
Create and return a ServletInputStream to read the content associated with this Request.protected javax.servlet.http.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.javax.servlet.http.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 nulljava.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>.javax.servlet.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.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.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.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.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(javax.servlet.http.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(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
Methods inherited from interface org.apache.catalina.HttpRequest getContextPathMB, getDecodedRequestURIMB, getPathInfoMB, getRequestPathMB, getServletPathMB
Methods inherited from interface org.apache.catalina.Request getFilterChain, getHost, getValveContext, javax.servlet.FilterChain)">setFilterChain, setHost, setValveContext
Methods inherited from interface javax.servlet.ServletRequest getLocalAddr, getLocalName, getLocalPort, getRemotePort
Field Detail coyoteRequest
protected Request coyoteRequest
- Coyote request.
sm
protected static StringManager sm
- The string manager for this package.
cookies
protected javax.servlet.http.Cookie[] cookies
- The set of cookies associated with this Request.
formats
protected java.text.SimpleDateFormat[] formats
- The set of SimpleDateFormat formats to use in getDateHeader().
defaultLocale
protected static java.util.Locale defaultLocale
- The default Locale if none are specified.
attributes
protected java.util.HashMap attributes
- The attributes associated with this Request, keyed by attribute name.
locales
protected java.util.ArrayList locales
- The preferred Locales assocaited with this Request.
authType
protected java.lang.String authType
- Authentication type.
reader
protected java.io.BufferedReader reader
- Reader. Note: At the moment, no attempt is being made at recycling the reader, but this could be implemented in the future, using a design like the one used for the output buffer.
inputStream
protected CoyoteInputStream inputStream
- ServletInputStream.
usingInputStream
protected boolean usingInputStream
- Using stream flag.
usingReader
protected boolean usingReader
- Using writer flag.
contextPath
protected java.lang.String contextPath
- Context path.
pathInfo
protected java.lang.String pathInfo
- Path info.
servletPath
protected java.lang.String servletPath
- Servlet path.
userPrincipal
protected java.security.Principal userPrincipal
- User principal.
sessionParsed
protected boolean sessionParsed
- Session parsed flag.
requestParametersParsed
protected boolean requestParametersParsed
- Request parameters parsed flag.
secure
protected boolean secure
- Secure flag.
CACHED_POST_LEN
protected static int CACHED_POST_LEN
- Post data buffer.
postData
protected byte[] postData
parameterMap
protected ParameterMap parameterMap
- Hash map used in the getParametersMap method.
session
protected Session session
- The currently active session for this request.
requestedSessionCookie
protected boolean requestedSessionCookie
- Was the requested session ID received in a cookie?
requestedSessionId
protected java.lang.String requestedSessionId
- The requested session ID (if any) for this request.
requestedSessionURL
protected boolean requestedSessionURL
- Was the requested session ID received in a URL?
socket
protected java.net.Socket socket
- The socket through which this Request was received.
localesParsed
protected boolean localesParsed
- Parse locales.
remoteAddr
protected java.lang.String remoteAddr
- Remote address.
remoteHost
protected java.lang.String remoteHost
- Remote host.
authorization
protected java.lang.String authorization
- The authorization credentials sent with this Request.
connector
protected CoyoteConnector connector
- Associated Catalina connector.
context
protected Context context
- The Context within which this Request is being processed.
info
protected static final java.lang.String info
- Descriptive information about this Request implementation.
- See Also:
- Constant Field Values
facade
protected CoyoteRequestFacade facade
- The facade associated with this request.
response
protected Response response
- The response with which this request is associated.
URIConverter
protected B2CConverter URIConverter
- URI byte to char converter (not recycled).
wrapper
protected Wrapper wrapper
- The Wrapper within which this Request is being processed.
Constructor Detail CoyoteRequest
public CoyoteRequest()
Method Detail setCoyoteRequest
public void setCoyoteRequest(Request coyoteRequest)
- Set the Coyote request.
- Parameters:
- coyoteRequest - The Coyote request
getCoyoteRequest
public Request getCoyoteRequest()
- Get the Coyote request.
recycle
public void recycle()
- Release all object references, and initialize instance variables, in preparation for reuse of this object.
- Specified by:
- recycle in interface Request
getAuthorization
public java.lang.String getAuthorization()
- Return the authorization credentials sent with this request.
- Specified by:
- getAuthorization in interface Request
setAuthorization
public void setAuthorization(java.lang.String authorization)
- Set the authorization credentials sent with this request.
- Specified by:
- setAuthorization in interface Request
- Parameters:
- authorization - The new authorization credentials
getConnector
public Connector getConnector()
- Return the Connector through which this Request was received.
- Specified by:
- getConnector in interface Request
setConnector
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
getContext
public Context getContext()
- Return the Context within which this Request is being processed.
- Specified by:
- getContext in interface Request
setContext
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 by getContextPath(), and thus enables parsing of the request URI.
- Specified by:
- setContext in interface Request
- Parameters:
- context - The newly associated Context
getInfo
public java.lang.String getInfo()
- Return descriptive information about this Request implementation and the corresponding version number, in the format <description>/<version>.
- Specified by:
- getInfo in interface Request
getRequest
public javax.servlet.ServletRequest getRequest()
- Return the ServletRequest for which this object is the facade. This method must be implemented by a subclass.
- Specified by:
- getRequest in interface Request
getResponse
public Response getResponse()
- Return the Response with which this Request is associated.
- Specified by:
- getResponse in interface Request
setResponse
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
getSocket
public java.net.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.
- Specified by:
- getSocket in interface Request
setSocket
public void setSocket(java.net.Socket socket)
- Set the Socket (if any) through which this Request was received.
- Specified by:
- setSocket in interface Request
- Parameters:
- socket - The socket through which this request was received
getStream
public java.io.InputStream getStream()
- Return the input stream associated with this Request.
- Specified by:
- getStream in interface Request
setStream
public void setStream(java.io.InputStream stream)
- Set the input stream associated with this Request.
- Specified by:
- setStream in interface Request
- Parameters:
- stream - The new input stream
getURIConverter
protected B2CConverter getURIConverter()
- Return the URI converter.
setURIConverter
protected void setURIConverter(B2CConverter URIConverter)
- Set the URI converter.
- Parameters:
- URIConverter - the new URI connverter
getWrapper
public Wrapper getWrapper()
- Return the Wrapper within which this Request is being processed.
- Specified by:
- getWrapper in interface Request
setWrapper
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
createInputStream
public javax.servlet.ServletInputStream createInputStream() throws java.io.IOException
- Create and return a ServletInputStream to read the content associated with this Request.
- Specified by:
- createInputStream in interface Request
- Throws:
- java.io.IOException - if an input/output error occurs
finishRequest
public void finishRequest() throws java.io.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
- Throws:
- java.io.IOException - if an input/output error occurs
getNote
public 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.
- Specified by:
- getNote in interface Request
- Parameters:
- name - Name of the note to be returned
getNoteNames
public java.util.Iterator getNoteNames()
- Return an Iterator containing the String names of all notes bindings that exist for this request.
- Specified by:
- getNoteNames in interface Request
removeNote
public void removeNote(java.lang.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
setNote
public 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.
- Specified by:
- setNote in interface Request
- Parameters:
- name - Name to which the object should be bound
- value - Object to be bound to the specified name
setContentLength
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
setContentType
public void setContentType(java.lang.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
setProtocol
public void setProtocol(java.lang.String protocol)
- Set the protocol name and version associated with this Request.
- Specified by:
- setProtocol in interface Request
- Parameters:
- protocol - Protocol name and version
setRemoteAddr
public void setRemoteAddr(java.lang.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
setRemoteHost
public void setRemoteHost(java.lang.String remoteHost)
- Set the fully qualified name of the remote client associated with this Request.
- Parameters:
- remoteHost - The remote host name
setScheme
public void setScheme(java.lang.String scheme)
- Set the name of the scheme associated with this request. Typical values are http, https, and ftp.
- Specified by:
- setScheme in interface Request
- Parameters:
- scheme - The scheme
setSecure
public void setSecure(boolean secure)
- Set the value to be returned by isSecure() for this Request.
- Specified by:
- setSecure in interface Request
- Parameters:
- secure - The new isSecure value
setServerName
public void setServerName(java.lang.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
setServerPort
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
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
- Return the specified request attribute if it exists; otherwise, return null.
- Specified by:
- getAttribute in interface javax.servlet.ServletRequest
- Parameters:
- name - Name of the request attribute to return
getAttributeNames
public java.util.Enumeration getAttributeNames()
- Return the names of all request attributes for this Request, or an empty Enumeration if there are none.
- Specified by:
- getAttributeNames in interface javax.servlet.ServletRequest
getCharacterEncoding
public java.lang.String getCharacterEncoding()
- Return the character encoding for this Request.
- Specified by:
- getCharacterEncoding in interface javax.servlet.ServletRequest
getContentLength
public int getContentLength()
- Return the content length for this Request.
- Specified by:
- getContentLength in interface javax.servlet.ServletRequest
getContentType
public java.lang.String getContentType()
- Return the content type for this Request.
- Specified by:
- getContentType in interface javax.servlet.ServletRequest
getInputStream
public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException
- Return the servlet input stream for this Request. The default implementation returns a servlet input stream created by createInputStream().
- Specified by:
- getInputStream in interface javax.servlet.ServletRequest
- Throws:
- java.lang.IllegalStateException - if getReader() has already been called for this request
- java.io.IOException - if an input/output error occurs
getLocale
public 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. If the request did not specify a preferred language, the server's default Locale is returned.
- Specified by:
- getLocale in interface javax.servlet.ServletRequest
getLocales
public 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. If the request did not specify a preferred language, the server's default Locale is returned.
- Specified by:
- getLocales in interface javax.servlet.ServletRequest
getParameter
public java.lang.String getParameter(java.lang.String name)
- Return the value of the specified request parameter, if any; otherwise, return null. If there is more than one value defined, return only the first one.
- Specified by:
- getParameter in interface javax.servlet.ServletRequest
- Parameters:
- name - Name of the desired request parameter
getParameterMap
public java.util.Map getParameterMap()
- Returns a 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.
- Specified by:
- getParameterMap in interface javax.servlet.ServletRequest
- Returns:
- A Map containing parameter names as keys and parameter values as map values.
getParameterNames
public java.util.Enumeration getParameterNames()
- Return the names of all defined request parameters for this request.
- Specified by:
- getParameterNames in interface javax.servlet.ServletRequest
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
- Return the defined values for the specified request parameter, if any; otherwise, return null.
- Specified by:
- getParameterValues in interface javax.servlet.ServletRequest
- Parameters:
- name - Name of the desired request parameter
getProtocol
public java.lang.String getProtocol()
- Return the protocol and version used to make this Request.
- Specified by:
- getProtocol in interface javax.servlet.ServletRequest
getReader
public java.io.BufferedReader getReader() throws java.io.IOException
- Read the Reader wrapping the input stream for this Request. The default implementation wraps a BufferedReader around the servlet input stream returned by createInputStream().
- Specified by:
- getReader in interface javax.servlet.ServletRequest
- Throws:
- java.lang.IllegalStateException - if getInputStream() has already been called for this request
- java.io.IOException - if an input/output error occurs
getRealPath
public java.lang.String getRealPath(java.lang.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.
- Specified by:
- getRealPath in interface javax.servlet.ServletRequest
- Parameters:
- path - Path to be translated
getRemoteAddr
public java.lang.String getRemoteAddr()
- Return the remote IP address making this Request.
- Specified by:
- getRemoteAddr in interface javax.servlet.ServletRequest
getRemoteHost
public java.lang.String getRemoteHost()
- Return the remote host name making this Request.
- Specified by:
- getRemoteHost in interface javax.servlet.ServletRequest
getRequestDispatcher
public 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.
- Specified by:
- getRequestDispatcher in interface javax.servlet.ServletRequest
- Parameters:
- path - Path of the resource to be wrapped
getScheme
public java.lang.String getScheme()
- Return the scheme used to make this Request.
- Specified by:
- getScheme in interface javax.servlet.ServletRequest
getServerName
public java.lang.String getServerName()
- Return the server name responding to this Request.
- Specified by:
- getServerName in interface javax.servlet.ServletRequest
getServerPort
public int getServerPort()
- Return the server port responding to this Request.
- Specified by:
- getServerPort in interface javax.servlet.ServletRequest
isSecure
public boolean isSecure()
- Was this request received on a secure connection?
- Specified by:
- isSecure in interface javax.servlet.ServletRequest
removeAttribute
public void removeAttribute(java.lang.String name)
- Remove the specified request attribute if it exists.
- Specified by:
- removeAttribute in interface javax.servlet.ServletRequest
- Parameters:
- name - Name of the request attribute to remove
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
- Set the specified request attribute to the specified value.
- Specified by:
- setAttribute in interface javax.servlet.ServletRequest
- Parameters:
- name - Name of the request attribute to set
- value - The associated value
setCharacterEncoding
public void setCharacterEncoding(java.lang.String enc) throws java.io.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 using getReader().
- Specified by:
- setCharacterEncoding in interface javax.servlet.ServletRequest
- Parameters:
- enc - The character encoding to be used
- Throws:
- java.io.UnsupportedEncodingException - if the specified encoding is not supported
- Since:
- Servlet 2.3
addCookie
public void addCookie(javax.servlet.http.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
addHeader
public void addHeader(java.lang.String name, java.lang.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 name
- value - The new header value
addLocale
public void addLocale(java.util.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
addParameter
public void addParameter(java.lang.String name, java.lang.String[] 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
- values - Corresponding values for this request parameter
clearCookies
public void clearCookies()
- Clear the collection of Cookies associated with this Request.
- Specified by:
- clearCookies in interface HttpRequest
clearHeaders
public void clearHeaders()
- Clear the collection of Headers associated with this Request.
- Specified by:
- clearHeaders in interface HttpRequest
clearLocales
public void clearLocales()
- Clear the collection of Locales associated with this Request.
- Specified by:
- clearLocales in interface HttpRequest
clearParameters
public void clearParameters()
- Clear the collection of parameters associated with this Request.
- Specified by:
- clearParameters in interface HttpRequest
setAuthType
public void setAuthType(java.lang.String type)
- Set the authentication type used for this request, if any; otherwise set the type to null. Typical values are "BASIC", "DIGEST", or "SSL".
- Specified by:
- setAuthType in interface HttpRequest
- Parameters:
- type - The authentication type used
setContextPath
public void setContextPath(java.lang.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
setMethod
public void setMethod(java.lang.String method)
- Set the HTTP request method used for this Request.
- Specified by:
- setMethod in interface HttpRequest
- Parameters:
- method - The request method
setQueryString
public void setQueryString(java.lang.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
setPathInfo
public void setPathInfo(java.lang.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
setRequestedSessionCookie
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
setRequestedSessionId
public void setRequestedSessionId(java.lang.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
setRequestedSessionURL
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
setRequestURI
public void setRequestURI(java.lang.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
setDecodedRequestURI
public void setDecodedRequestURI(java.lang.String uri)
- Set the decoded request URI.
- Specified by:
- setDecodedRequestURI in interface HttpRequest
- Parameters:
- uri - The decoded request URI
getDecodedRequestURI
public java.lang.String getDecodedRequestURI()
- Get the decoded request URI.
- Specified by:
- getDecodedRequestURI in interface HttpRequest
- Returns:
- the URL decoded request URI
setServletPath
public void setServletPath(java.lang.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
setUserPrincipal
public void setUserPrincipal(java.security.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 the getRemoteUser() method.
- Specified by:
- setUserPrincipal in interface HttpRequest
- Parameters:
- principal - The user Principal
getAuthType
public java.lang.String getAuthType()
- Return the authentication type used for this Request.
- Specified by:
- getAuthType in interface javax.servlet.http.HttpServletRequest
getContextPath
public java.lang.String getContextPath()
- Return the portion of the request URI used to select the Context of the Request.
- Specified by:
- getContextPath in interface javax.servlet.http.HttpServletRequest
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Return the set of Cookies received with this Request.
- Specified by:
- getCookies in interface javax.servlet.http.HttpServletRequest
setCookies
public void setCookies(javax.servlet.http.Cookie[] cookies)
- Set the set of cookies recieved with this Request.
getDateHeader
public long getDateHeader(java.lang.String name)
- Return the value of the specified date header, if any; otherwise return -1.
- Specified by:
- getDateHeader in interface javax.servlet.http.HttpServletRequest
- Parameters:
- name - Name of the requested date header
- Throws:
- java.lang.IllegalArgumentException - if the specified header value cannot be converted to a date
getHeader
public java.lang.String getHeader(java.lang.String name)
- Return the first value of the specified header, if any; otherwise, return null
- Specified by:
- getHeader in interface javax.servlet.http.HttpServletRequest
- Parameters:
- name - Name of the requested header
getHeaders
public java.util.Enumeration getHeaders(java.lang.String name)
- Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
- Specified by:
- getHeaders in interface javax.servlet.http.HttpServletRequest
- Parameters:
- name - Name of the requested header
getHeaderNames
public java.util.Enumeration getHeaderNames()
- Return the names of all headers received with this request.
- Specified by:
- getHeaderNames in interface javax.servlet.http.HttpServletRequest
getIntHeader
public 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.
- Specified by:
- getIntHeader in interface javax.servlet.http.HttpServletRequest
- Parameters:
- name - Name of the requested header
- Throws:
- java.lang.IllegalArgumentException - if the specified header value cannot be converted to an integer
getMethod
public java.lang.String getMethod()
- Return the HTTP request method used in this Request.
- Specified by:
- getMethod in interface javax.servlet.http.HttpServletRequest
getPathInfo
public java.lang.String getPathInfo()
- Return the path information associated with this Request.
- Specified by:
- getPathInfo in interface javax.servlet.http.HttpServletRequest
getPathTranslated
public java.lang.String getPathTranslated()
- Return the extra path information for this request, translated to a real path.
- Specified by:
- getPathTranslated in interface javax.servlet.http.HttpServletRequest
getQueryString
public java.lang.String getQueryString()
- Return the query string associated with this request.
- Specified by:
- getQueryString in interface javax.servlet.http.HttpServletRequest
getRemoteUser
public java.lang.String getRemoteUser()
- Return the name of the remote user that has been authenticated for this Request.
- Specified by:
- getRemoteUser in interface javax.servlet.http.HttpServletRequest
getRequestedSessionId
public java.lang.String getRequestedSessionId()
- Return the session identifier included in this request, if any.
- Specified by:
- getRequestedSessionId in interface javax.servlet.http.HttpServletRequest
getRequestURI
public java.lang.String getRequestURI()
- Return the request URI for this request.
- Specified by:
- getRequestURI in interface javax.servlet.http.HttpServletRequest
getRequestURL
public java.lang.StringBuffer getRequestURL()
- Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
Because this method returns a StringBuffer, not a String, you can modify the URL easily, for example, to append query parameters.
This method is useful for creating redirect messages and for reporting errors.
- Specified by:
- getRequestURL in interface javax.servlet.http.HttpServletRequest
- Returns:
- A StringBuffer object containing the reconstructed URL
getServletPath
public java.lang.String getServletPath()
- Return the portion of the request URI used to select the servlet that will process this request.
- Specified by:
- getServletPath in interface javax.servlet.http.HttpServletRequest
getSession
public javax.servlet.http.HttpSession getSession()
- Return the session associated with this Request, creating one if necessary.
- Specified by:
- getSession in interface javax.servlet.http.HttpServletRequest
getSession
public javax.servlet.http.HttpSession getSession(boolean create)
- Return the session associated with this Request, creating one if necessary and requested.
- Specified by:
- getSession in interface javax.servlet.http.HttpServletRequest
- Parameters:
- create - Create a new session if one does not exist
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Return true if the session identifier included in this request came from a cookie.
- Specified by:
- isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Return true if the session identifier included in this request came from the request URI.
- Specified by:
- isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
- Deprecated. As of Version 2.1 of the Java Servlet API, use isRequestedSessionIdFromURL() instead.
- Return true if the session identifier included in this request came from the request URI.
- Specified by:
- isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Return true if the session identifier included in this request identifies a valid session.
- Specified by:
- isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest
isUserInRole
public boolean isUserInRole(java.lang.String role)
- Return true if the authenticated user principal possesses the specified role name.
- Specified by:
- isUserInRole in interface javax.servlet.http.HttpServletRequest
- Parameters:
- role - Role name to be validated
getUserPrincipal
public java.security.Principal getUserPrincipal()
- Return the principal that has been authenticated for this Request.
- Specified by:
- getUserPrincipal in interface javax.servlet.http.HttpServletRequest
doGetSession
protected javax.servlet.http.HttpSession doGetSession(boolean create)
parseRequestParameters
protected void parseRequestParameters()
- Parse request parameters.
readPostBody
protected int readPostBody(byte[] body, int len) throws java.io.IOException
- Read post body in an array.
- Throws:
- java.io.IOException
parseLocales
protected void parseLocales()
- Parse request locales.
parseLocalesHeader
protected void parseLocalesHeader(java.lang.String value)
- Parse accept-language header value.
Overview Package Class Tree Deprecated Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD
Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.