|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.connector.Request
public class Request
Wrapper object for the Coyote request.
Nested Class Summary | |
---|---|
class |
Request.AsyncContextImpl
|
class |
Request.AsyncListenerRegistration
|
Field Summary | |
---|---|
protected Request.AsyncContextImpl |
asyncContext
Servlet 3.0 asynchronous mode context (also used as a flag - when not null, we're in asynchronous mode). |
protected java.util.LinkedHashMap<javax.servlet.AsyncListener,Request.AsyncListenerRegistration> |
asyncListeners
Async listeners. |
protected long |
asyncTimeout
Async timeout. |
protected java.util.HashMap |
attributes
The attributes associated with this Request, keyed by attribute name. |
protected java.lang.String |
authType
Authentication type. |
protected static int |
CACHED_POST_LEN
Post data buffer. |
protected boolean |
canStartAsync
Can call startAsync. |
protected static boolean |
CHECK_ASYNC
|
protected Connector |
connector
Associated Catalina connector. |
protected Context |
context
Associated context. |
protected javax.servlet.http.Cookie[] |
cookies
The set of cookies associated with this Request. |
protected boolean |
cookiesParsed
Cookies parsed flag. |
protected Request |
coyoteRequest
Coyote request. |
protected int |
currentFilterChain
Number of filter chains used. |
protected static java.util.Locale |
defaultLocale
The default Locale if none are specified. |
protected java.lang.Object |
dispatcherType
The current dispatcher type. |
protected HttpEventImpl |
event
Associated event. |
protected boolean |
eventMode
Event mode flag |
protected RequestFacade |
facade
The facade associated with this request. |
protected java.util.ArrayList<ApplicationFilterChain> |
filterChains
Filter chains associated with the request. |
protected java.text.SimpleDateFormat[] |
formats
The set of SimpleDateFormat formats to use in getDateHeader(). |
protected static java.util.TimeZone |
GMT_ZONE
|
protected static java.lang.String |
info
Descriptive information about this Request implementation. |
protected InputBuffer |
inputBuffer
The associated input buffer. |
protected CoyoteInputStream |
inputStream
ServletInputStream. |
protected java.lang.String |
localAddr
Local address |
protected java.util.ArrayList |
locales
The preferred Locales assocaited with this Request. |
protected boolean |
localesParsed
Parse locales. |
protected java.lang.String |
localName
Local address |
protected int |
localPort
Local port |
protected MappingData |
mappingData
Mapping data. |
protected ParameterMap |
parameterMap
Hash map used in the getParametersMap method. |
protected boolean |
parametersParsed
Request parameters parsed flag. |
protected java.util.Map<java.lang.String,javax.servlet.http.Part> |
parts
Parts associated with the request. |
protected byte[] |
postData
|
protected CoyoteReader |
reader
Reader. |
protected java.lang.String |
remoteAddr
Remote address. |
protected java.lang.String |
remoteHost
Remote host. |
protected int |
remotePort
Remote port |
protected java.lang.Object |
requestDispatcherPath
The current request dispatcher path. |
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 Response |
response
The response with which this request is associated. |
protected boolean |
secure
Secure flag. |
protected Session |
session
The currently active session for this request. |
protected static boolean |
SESSION_ID_CHECK
|
protected boolean |
sessionParsed
Session parsed flag. |
protected static StringManager |
sm
The string manager for this package. |
protected javax.security.auth.Subject |
subject
The Subject associated with the current AccessControllerContext |
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 static boolean |
WRAPPED_RESPONSE_IN_LOGIN
|
protected Wrapper |
wrapper
Associated wrapper. |
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
Request()
|
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. |
boolean |
authenticate(javax.servlet.http.HttpServletResponse response)
Use the container login mechanism configured for the ServletContext to authenticate the user making
this request. |
void |
changeSessionId(java.lang.String newSessionId)
Change the ID of the session that this request is associated with. |
void |
clearCookies()
Clear the collection of Cookies associated with this Request. |
void |
clearEncoders()
Clear cached encoders (to save memory for event or async requests). |
void |
clearHeaders()
Clear the collection of Headers associated with this Request. |
void |
clearLocales()
Clear the collection of Locales associated with this Request. |
void |
clearParameters()
Clear the collection of parameters associated with this Request. |
protected void |
configureSessionCookie(javax.servlet.http.Cookie cookie)
Configures the given JSESSIONID cookie. |
javax.servlet.ServletInputStream |
createInputStream()
Create and return a ServletInputStream to read the content associated with this Request. |
protected Session |
doGetSession(boolean create)
|
void |
finishRequest()
Perform whatever actions are required to flush and close the input stream or reader, in a single operation. |
javax.servlet.AsyncContext |
getAsyncContext()
Gets the AsyncContext that was created or reinitialized by the most recent invocation of ServletRequest.startAsync() or
ServletRequest.startAsync(ServletRequest,ServletResponse) on this request. |
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 |
getAuthType()
Return the authentication type used for this Request. |
boolean |
getCanStartAsync()
|
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. |
MessageBytes |
getContextPathMB()
Get the context path. |
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. |
MessageBytes |
getDecodedRequestURIMB()
Get the decoded request URI. |
javax.servlet.DispatcherType |
getDispatcherType()
Gets the dispatcher type of this request. |
HttpEventImpl |
getEvent()
Get the event associated with the request. |
ApplicationFilterChain |
getFilterChain()
Get filter chain associated with the request. |
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. |
Host |
getHost()
Return the Host within which this Request is being processed. |
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.lang.String |
getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received. |
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 |
getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received. |
int |
getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received. |
MappingData |
getMappingData()
Return mapping data. |
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 . |
javax.servlet.http.Part |
getPart(java.lang.String name)
Gets the Part with the given name. |
java.util.Collection<javax.servlet.http.Part> |
getParts()
Gets all the Part components of this request, provided
that it is of type multipart/form-data. |
java.lang.String |
getPathInfo()
Return the path information associated with this Request. |
MessageBytes |
getPathInfoMB()
Get the path info. |
java.lang.String |
getPathTranslated()
Return the extra path information for this request, translated to a real path. |
java.security.Principal |
getPrincipal()
Return the principal that has been authenticated for this Request. |
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. |
int |
getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request. |
java.lang.String |
getRemoteUser()
Return the name of the remote user that has been authenticated for this Request. |
javax.servlet.http.HttpServletRequest |
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. |
javax.servlet.http.HttpServletRequest |
getRequestFacade()
Alias for AsyncContext inner class. |
MessageBytes |
getRequestPathMB()
Get the request path. |
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. |
javax.servlet.http.HttpServletResponse |
getResponseFacade()
Alias for AsyncContext inner class. |
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. |
javax.servlet.ServletContext |
getServletContext()
Gets the servlet context to which this ServletRequest was last dispatched. |
javax.servlet.ServletContext |
getServletContext0()
|
java.lang.String |
getServletPath()
Return the portion of the request URI used to select the servlet that will process this request. |
MessageBytes |
getServletPathMB()
Get the servlet path. |
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. |
Session |
getSessionInternal()
Return the session associated with this Request, creating one if necessary. |
Session |
getSessionInternal(boolean create)
Return the session associated with this Request, creating one if necessary and requested. |
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. |
protected static boolean |
isAlpha(java.lang.String value)
|
boolean |
isAsyncStarted()
Checks if this request has been put into asynchronous mode. |
boolean |
isAsyncSupported()
Checks if this request supports asynchronous operation. |
boolean |
isEof()
Return true if the EOF has been reached. |
boolean |
isEventMode()
Return true if the current request is using event mode. |
boolean |
isReadable()
Return true if bytes are available. |
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. |
void |
login(java.lang.String username,
java.lang.String password)
Validate the provided username and password in the password validation realm used by the web container login mechanism configured for the ServletContext . |
void |
logout()
Establish null as the value returned when
getUserPrincipal , getRemoteUser ,
and getAuthType is called on the request. |
void |
nextFilterChain()
Set filter chain associated with the request. |
protected void |
parseCookies()
Parse cookies. |
protected void |
parseLocales()
Parse request locales. |
protected void |
parseLocalesHeader(java.lang.String value)
Parse accept-language header value. |
protected void |
parseMultipart()
Parse multipart. |
protected void |
parseParameters()
Parse request parameters. |
int |
read()
Read bytes into the low level buffer. |
protected byte[] |
readChunkedPostBody()
Read chunked post body. |
protected int |
readPostBody(byte[] body,
int len)
Read post body in an array. |
boolean |
ready()
Return true if bytes or chars are available. |
void |
recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object. |
void |
releaseFilterChain()
Set filter chain associated with the request. |
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 |
resume()
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set the specified request attribute to the specified value. |
void |
setAuthType(java.lang.String type)
Set the authentication type used for this request, if any; otherwise set the type to null . |
void |
setCanStartAsync(boolean canStartAsync)
|
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 |
setEventMode(boolean eventMode)
Set event mode. |
void |
setFilterChain(ApplicationFilterChain filterChain)
Set filter chain associated with the request. |
void |
setHost(Host host)
Set the Host within which this Request is being processed. |
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 |
setStream(java.io.InputStream stream)
Set the input stream associated with this Request. |
void |
setTimeout(int timeout)
Set connection timeout. |
void |
setTimeout0(int timeout)
|
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. |
javax.servlet.AsyncContext |
startAsync()
Puts this request into asynchronous mode, and initializes its AsyncContext with the original (unwrapped) ServletRequest
and ServletResponse objects. |
javax.servlet.AsyncContext |
startAsync(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
Puts this request into asynchronous mode, and initializes its AsyncContext with the given request and response objects. |
void |
suspend()
|
java.lang.String |
toString()
|
protected java.lang.String |
unescape(java.lang.String s)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final boolean SESSION_ID_CHECK
protected static final boolean WRAPPED_RESPONSE_IN_LOGIN
protected static final boolean CHECK_ASYNC
protected Request coyoteRequest
protected static final java.util.TimeZone GMT_ZONE
protected static StringManager sm
protected javax.servlet.http.Cookie[] cookies
protected java.text.SimpleDateFormat[] formats
protected static java.util.Locale defaultLocale
protected java.util.HashMap attributes
protected java.util.ArrayList locales
protected Request.AsyncContextImpl asyncContext
protected java.lang.String authType
protected long asyncTimeout
protected java.util.LinkedHashMap<javax.servlet.AsyncListener,Request.AsyncListenerRegistration> asyncListeners
protected HttpEventImpl event
protected boolean eventMode
protected java.lang.Object dispatcherType
protected InputBuffer inputBuffer
protected CoyoteInputStream inputStream
protected CoyoteReader reader
protected boolean usingInputStream
protected boolean usingReader
protected java.security.Principal userPrincipal
protected boolean sessionParsed
protected boolean parametersParsed
protected boolean cookiesParsed
protected boolean secure
protected transient javax.security.auth.Subject subject
protected static int CACHED_POST_LEN
protected byte[] postData
protected java.util.Map<java.lang.String,javax.servlet.http.Part> parts
protected ParameterMap parameterMap
protected Session session
protected java.lang.Object requestDispatcherPath
protected boolean requestedSessionCookie
protected java.lang.String requestedSessionId
protected boolean requestedSessionURL
protected boolean localesParsed
protected int localPort
protected java.lang.String remoteAddr
protected java.lang.String remoteHost
protected int remotePort
protected java.lang.String localAddr
protected java.lang.String localName
protected boolean canStartAsync
protected Connector connector
protected Context context
protected java.util.ArrayList<ApplicationFilterChain> filterChains
protected int currentFilterChain
protected static final java.lang.String info
protected MappingData mappingData
protected RequestFacade facade
protected Response response
protected B2CConverter URIConverter
protected Wrapper wrapper
Constructor Detail |
---|
public Request()
Method Detail |
---|
public void setCoyoteRequest(Request coyoteRequest)
coyoteRequest
- The Coyote requestpublic Request getCoyoteRequest()
public void recycle()
public void clearEncoders()
public int read() throws java.io.IOException
java.io.IOException
public boolean isEof() throws java.io.IOException
java.io.IOException
public boolean isReadable()
public 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 ApplicationFilterChain getFilterChain()
public void setFilterChain(ApplicationFilterChain filterChain)
filterChain
- new filter chainpublic void nextFilterChain()
filterChain
- new filter chainpublic void releaseFilterChain()
filterChain
- new filter chainpublic Host getHost()
public void setHost(Host host)
host
- The newly associated Hostpublic java.lang.String getInfo()
<description>/<version>
.
public MappingData getMappingData()
public javax.servlet.http.HttpServletRequest getRequest()
ServletRequest
for which this object
is the facade. This method must be implemented by a subclass.
public javax.servlet.http.HttpServletRequest getRequestFacade()
public Response getResponse()
public void setResponse(Response response)
response
- The new associated responsepublic javax.servlet.http.HttpServletResponse getResponseFacade()
public 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 boolean getCanStartAsync()
public void setCanStartAsync(boolean canStartAsync)
public javax.servlet.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
.
getAttribute
in interface javax.servlet.ServletRequest
name
- Name of the request attribute to return
Object
containing the value
of the attribute, or null
if
the attribute does not existpublic java.util.Enumeration getAttributeNames()
Enumeration
if there are none.
getAttributeNames
in interface javax.servlet.ServletRequest
Enumeration
of strings
containing the names
of the request's attributespublic java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
String
containing the name of
the character encoding, or null
if the request does not specify a character encodingpublic int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletRequest
String
containing the name
of the MIME type of
the request, or null if the type is not knownpublic javax.servlet.ServletInputStream getInputStream() throws java.io.IOException
createInputStream()
.
getInputStream
in interface javax.servlet.ServletRequest
ServletInputStream
object containing
the body of the request
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.
getLocale
in interface javax.servlet.ServletRequest
Locale
for the clientpublic 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.
getLocales
in interface javax.servlet.ServletRequest
Enumeration
of preferred
Locale
objects for the clientpublic java.lang.String getParameter(java.lang.String name)
null
. If there is more than one value defined,
return only the first one.
getParameter
in interface javax.servlet.ServletRequest
name
- Name of the desired request parameter
String
representing the
single value of the parameterServletRequest.getParameterValues(java.lang.String)
public 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.
getParameterMap
in interface javax.servlet.ServletRequest
Map
containing parameter names as keys
and parameter values as map values.public java.util.Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
Enumeration
of String
objects, each String
containing
the name of a request parameter; or an
empty Enumeration
if the
request has no parameterspublic java.lang.String[] getParameterValues(java.lang.String name)
null
.
getParameterValues
in interface javax.servlet.ServletRequest
name
- Name of the desired request parameter
String
objects
containing the parameter's valuesServletRequest.getParameter(java.lang.String)
public java.lang.String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
String
containing the protocol
name and version numberpublic java.io.BufferedReader getReader() throws java.io.IOException
BufferedReader
around the
servlet input stream returned by createInputStream()
.
getReader
in interface javax.servlet.ServletRequest
BufferedReader
containing the body of the request
java.lang.IllegalStateException
- if getInputStream()
has already been called for this request
java.io.IOException
- if an input/output error occursServletRequest.getInputStream()
public java.lang.String getRealPath(java.lang.String path)
ServletContext.getRealPath()
.
getRealPath
in interface javax.servlet.ServletRequest
path
- Path to be translatedpublic java.lang.String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
String
containing the
IP address of the client that sent the requestpublic java.lang.String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
String
containing the fully
qualified name of the clientpublic int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public java.lang.String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
String
containing the host
name of the IP on which the request was received.public java.lang.String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
String
containing the
IP address on which the request was received.public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
path
- Path of the resource to be wrapped
RequestDispatcher
object
that acts as a wrapper for the resource
at the specified path, or null
if the servlet container cannot return a
RequestDispatcher
RequestDispatcher
,
ServletContext.getRequestDispatcher(java.lang.String)
public java.lang.String getScheme()
getScheme
in interface javax.servlet.ServletRequest
String
containing the name
of the scheme used to make this requestpublic java.lang.String getServerName()
getServerName
in interface javax.servlet.ServletRequest
String
containing the name
of the serverpublic int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletRequest
name
- Name of the request attribute to removepublic void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletRequest
name
- Name of the request attribute to setvalue
- The associated valuepublic void setCharacterEncoding(java.lang.String enc) throws java.io.UnsupportedEncodingException
getReader()
.
setCharacterEncoding
in interface javax.servlet.ServletRequest
enc
- The character encoding to be used
java.io.UnsupportedEncodingException
- if the specified encoding
is not supportedpublic 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 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 changeSessionId(java.lang.String newSessionId)
session
- The session to change the session ID forpublic 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 MessageBytes getDecodedRequestURIMB()
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()
getAuthType
in interface javax.servlet.http.HttpServletRequest
null
if the request was
not authenticated.public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
String
specifying the
portion of the request URI that indicates the context
of the requestServletContext.getContextPath()
public MessageBytes getContextPathMB()
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
Cookies
included with this request, or null
if the request has no cookiespublic void setCookies(javax.servlet.http.Cookie[] cookies)
public long getDateHeader(java.lang.String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
name
- Name of the requested date header
long
value
representing the date specified
in the header expressed as
the number of milliseconds
since January 1, 1970 GMT,
or -1 if the named header
was not included with the
request
java.lang.IllegalArgumentException
- if the specified header value
cannot be converted to a datepublic java.lang.String getHeader(java.lang.String name)
null
getHeader
in interface javax.servlet.http.HttpServletRequest
name
- Name of the requested header
String
containing the
value of the requested
header, or null
if the request does not
have a header of that namepublic java.util.Enumeration getHeaders(java.lang.String name)
getHeaders
in interface javax.servlet.http.HttpServletRequest
name
- Name of the requested header
Enumeration
containing
the values of the requested header. If
the request does not have any headers of
that name return an empty
enumeration. If
the container does not allow access to
header information, return nullpublic java.util.Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
null
public int getIntHeader(java.lang.String name)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
name
- Name of the requested header
java.lang.IllegalArgumentException
- if the specified header value
cannot be converted to an integerpublic java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
String
specifying the name
of the method with which
this request was madepublic java.lang.String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
String
, decoded by the
web container, specifying
extra path information that comes
after the servlet path but before
the query string in the request URL;
or null
if the URL does not have
any extra path informationpublic MessageBytes getPathInfoMB()
public java.lang.String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
String
specifying the
real path, or null
if
the URL does not have any extra path
informationpublic java.lang.String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
String
containing the query
string or null
if the URL
contains no query string. The value is not
decoded by the container.public java.lang.String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
String
specifying the login
of the user making this request, or null
if the user login is not knownpublic MessageBytes getRequestPathMB()
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
String
specifying the session
ID, or null
if the request did
not specify a session IDHttpServletRequest.isRequestedSessionIdValid()
public java.lang.String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
String
containing
the part of the URL from the
protocol name up to the query stringHttpUtils.getRequestURL(javax.servlet.http.HttpServletRequest)
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.
getRequestURL
in interface javax.servlet.http.HttpServletRequest
StringBuffer
object containing the
reconstructed URLpublic javax.servlet.ServletContext getServletContext()
javax.servlet.ServletRequest
getServletContext
in interface javax.servlet.ServletRequest
public javax.servlet.ServletContext getServletContext0()
public java.lang.String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
String
containing
the name or path of the servlet being
called, as specified in the request URL,
decoded, or an empty string if the servlet
used to process the request is matched
using the "/*" pattern.public MessageBytes getServletPathMB()
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
HttpSession
associated
with this requestHttpServletRequest.getSession(boolean)
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
create
- Create a new session if one does not exist
HttpSession
associated
with this request or null
if
create
is false
and the request has no valid sessionHttpServletRequest.getSession()
public boolean isRequestedSessionIdFromCookie()
true
if the session identifier included in this
request came from a cookie.
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
true
if the session ID
came in as a
cookie; otherwise, false
HttpServletRequest.getSession(boolean)
public boolean isRequestedSessionIdFromURL()
true
if the session identifier included in this
request came from the request URI.
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
true
if the session ID
came in as part of a URL; otherwise,
false
HttpServletRequest.getSession(boolean)
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromURL()
instead.
true
if the session identifier included in this
request came from the request URI.
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdValid()
true
if the session identifier included in this
request identifies a valid session.
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
true
if this
request has an id for a valid session
in the current session context;
false
otherwiseHttpServletRequest.getRequestedSessionId()
,
HttpServletRequest.getSession(boolean)
,
HttpSessionContext
public boolean isUserInRole(java.lang.String role)
true
if the authenticated user principal
possesses the specified role name.
isUserInRole
in interface javax.servlet.http.HttpServletRequest
role
- Role name to be validated
boolean
indicating whether
the user making this request belongs to a given role;
false
if the user has not been
authenticatedpublic java.security.Principal getPrincipal()
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
java.security.Principal
containing
the name of the user making this request;
null
if the user has not been
authenticatedpublic Session getSessionInternal()
public Session getSessionInternal(boolean create)
create
- Create a new session if one does not existpublic HttpEventImpl getEvent()
public boolean isEventMode()
public void setEventMode(boolean eventMode)
public boolean ready()
public void setTimeout(int timeout)
public void setTimeout0(int timeout)
public void resume()
public void suspend()
protected Session doGetSession(boolean create)
protected void configureSessionCookie(javax.servlet.http.Cookie cookie)
cookie
- The JSESSIONID cookie to be configuredprotected java.lang.String unescape(java.lang.String s)
protected void parseCookies()
protected void parseParameters()
protected byte[] readChunkedPostBody() throws java.io.IOException
java.io.IOException
protected void parseMultipart() throws java.io.IOException, javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
protected int readPostBody(byte[] body, int len) throws java.io.IOException
java.io.IOException
protected void parseLocales()
protected void parseLocalesHeader(java.lang.String value)
protected static final boolean isAlpha(java.lang.String value)
public javax.servlet.AsyncContext getAsyncContext()
javax.servlet.ServletRequest
ServletRequest.startAsync()
or
ServletRequest.startAsync(ServletRequest,ServletResponse)
on this request.
getAsyncContext
in interface javax.servlet.ServletRequest
ServletRequest.startAsync()
or
ServletRequest.startAsync(ServletRequest,ServletResponse)
on
this requestpublic boolean isAsyncStarted()
javax.servlet.ServletRequest
A ServletRequest is put into asynchronous mode by calling
ServletRequest.startAsync()
or
ServletRequest.startAsync(ServletRequest,ServletResponse)
on it.
This method returns false if this request was
put into asynchronous mode, but has since been dispatched using
one of the AsyncContext.dispatch()
methods or released
from asynchronous mode via a call to AsyncContext.complete()
.
isAsyncStarted
in interface javax.servlet.ServletRequest
public boolean isAsyncSupported()
javax.servlet.ServletRequest
Asynchronous operation is disabled for this request if this request is within the scope of a filter or servlet that has not been annotated or flagged in the deployment descriptor as being able to support asynchronous handling.
isAsyncSupported
in interface javax.servlet.ServletRequest
public javax.servlet.AsyncContext startAsync() throws java.lang.IllegalStateException
javax.servlet.ServletRequest
AsyncContext
with the original (unwrapped) ServletRequest
and ServletResponse objects.
Calling this method will cause committal of the associated
response to be delayed until AsyncContext.complete()
is
called on the returned AsyncContext
, or the asynchronous
operation has timed out.
Calling AsyncContext.hasOriginalRequestAndResponse()
on
the returned AsyncContext will return true
. Any filters
invoked in the outbound direction after this request was put
into asynchronous mode may use this as an indication that any request
and/or response wrappers that they added during their inbound
invocation need not stay around for the duration of the asynchronous
operation, and therefore any of their associated resources may be
released.
This method clears the list of AsyncListener
instances
(if any) that were registered with the AsyncContext returned by the
previous call to one of the startAsync methods, after calling each
AsyncListener at its onStartAsync
method.
Subsequent invocations of this method, or its overloaded variant, will return the same AsyncContext instance, reinitialized as appropriate.
startAsync
in interface javax.servlet.ServletRequest
java.lang.IllegalStateException
- if this request is within the scope of
a filter or servlet that does not support asynchronous operations
(that is, ServletRequest.isAsyncSupported()
returns false),
or if this method is called again without any asynchronous dispatch
(resulting from one of the AsyncContext.dispatch()
methods),
is called outside the scope of any such dispatch, or is called again
within the scope of the same dispatch, or if the response has
already been closedpublic javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws java.lang.IllegalStateException
javax.servlet.ServletRequest
AsyncContext
with the given request and response objects.
The ServletRequest and ServletResponse arguments must be
the same instances, or instances of ServletRequestWrapper
and
ServletResponseWrapper
that wrap them, that were passed to the
service
method of the Servlet or the
doFilter
method of the Filter, respectively,
in whose scope this method is being called.
Calling this method will cause committal of the associated
response to be delayed until AsyncContext.complete()
is
called on the returned AsyncContext
, or the asynchronous
operation has timed out.
Calling AsyncContext.hasOriginalRequestAndResponse()
on
the returned AsyncContext will return false
,
unless the passed in ServletRequest and ServletResponse arguments
are the original ones or do not carry any application-provided wrappers.
Any filters invoked in the outbound direction after this
request was put into asynchronous mode may use this as an indication
that some of the request and/or response wrappers that they added
during their inbound invocation may need to stay in place for
the duration of the asynchronous operation, and their associated
resources may not be released.
A ServletRequestWrapper applied during the inbound
invocation of a filter may be released by the outbound
invocation of the filter only if the given servletRequest
,
which is used to initialize the AsyncContext and will be returned by
a call to AsyncContext.getRequest()
, does not contain said
ServletRequestWrapper. The same holds true for ServletResponseWrapper
instances.
This method clears the list of AsyncListener
instances
(if any) that were registered with the AsyncContext returned by the
previous call to one of the startAsync methods, after calling each
AsyncListener at its onStartAsync
method.
Subsequent invocations of this method, or its zero-argument variant, will return the same AsyncContext instance, reinitialized as appropriate. If a call to this method is followed by a call to its zero-argument variant, the specified (and possibly wrapped) request and response objects will remain locked in on the returned AsyncContext.
startAsync
in interface javax.servlet.ServletRequest
servletRequest
- the ServletRequest used to initialize the
AsyncContextservletResponse
- the ServletResponse used to initialize the
AsyncContext
java.lang.IllegalStateException
- if this request is within the scope of
a filter or servlet that does not support asynchronous operations
(that is, ServletRequest.isAsyncSupported()
returns false),
or if this method is called again without any asynchronous dispatch
(resulting from one of the AsyncContext.dispatch()
methods),
is called outside the scope of any such dispatch, or is called again
within the scope of the same dispatch, or if the response has
already been closedpublic boolean authenticate(javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
javax.servlet.http.HttpServletRequest
ServletContext
to authenticate the user making
this request.
This method may modify and commit the argument
HttpServletResponse
.
authenticate
in interface javax.servlet.http.HttpServletRequest
response
- The HttpServletResponse
associated with this HttpServletRequest
true
when non-null values were or have been
established as the values returned by getUserPrincipal
,
getRemoteUser
, and getAuthType
. Return
false
if authentication is incomplete and the underlying
login mechanism has committed, in the response, the message (e.g.,
challenge) and HTTP status code to be returned to the user.
java.io.IOException
- if an input or output error occurred while
reading from this request or writing to the given response
javax.servlet.ServletException
- if the authentication failed and
the caller is responsible for handling the error (i.e., the
underlying login mechanism did NOT establish the message and
HTTP status code to be returned to the user)public void login(java.lang.String username, java.lang.String password) throws javax.servlet.ServletException
javax.servlet.http.HttpServletRequest
ServletContext
.
This method returns without throwing a ServletException
when the login mechanism configured for the ServletContext
supports username password validation, and when, at the time of the
call to login, the identity of the caller of the request had
not been established (i.e, all of getUserPrincipal
,
getRemoteUser
, and getAuthType
return null),
and when validation of the provided credentials is successful.
Otherwise, this method throws a ServletException
as
described below.
When this method returns without throwing an exception, it must
have established non-null values as the values returned by
getUserPrincipal
, getRemoteUser
, and
getAuthType
.
login
in interface javax.servlet.http.HttpServletRequest
username
- The String
value corresponding to
the login identifier of the user.password
- The password String
corresponding
to the identified user.
javax.servlet.ServletException
- if the configured login mechanism
does not support username
password authentication, or if a
non-null caller identity had
already been established (prior
to the call to login), or if
validation of the provided
username and password fails.public void logout() throws javax.servlet.ServletException
javax.servlet.http.HttpServletRequest
null
as the value returned when
getUserPrincipal
, getRemoteUser
,
and getAuthType
is called on the request.
logout
in interface javax.servlet.http.HttpServletRequest
javax.servlet.ServletException
- if logout failspublic javax.servlet.DispatcherType getDispatcherType()
javax.servlet.ServletRequest
The dispatcher type of a request is used by the container to select the filters that need to be applied to the request: Only filters with matching dispatcher type and url patterns will be applied.
Allowing a filter that has been configured for multiple dispatcher types to query a request for its dispatcher type allows the filter to process the request differently depending on its dispatcher type.
The initial dispatcher type of a request is defined as
DispatcherType.REQUEST
. The dispatcher type of a request
dispatched via RequestDispatcher.forward(ServletRequest,
ServletResponse)
or RequestDispatcher.include(ServletRequest,
ServletResponse)
is given as DispatcherType.FORWARD
or
DispatcherType.INCLUDE
, respectively, while the
dispatcher type of an asynchronous request dispatched via
one of the AsyncContext.dispatch()
methods is given as
DispatcherType.ASYNC
. Finally, the dispatcher type of a
request dispatched to an error page by the container's error handling
mechanism is given as DispatcherType.ERROR
.
getDispatcherType
in interface javax.servlet.ServletRequest
DispatcherType
public javax.servlet.http.Part getPart(java.lang.String name) throws java.io.IOException, javax.servlet.ServletException
javax.servlet.http.HttpServletRequest
Part
with the given name.
getPart
in interface javax.servlet.http.HttpServletRequest
name
- the name of the requested Part
java.io.IOException
- if an I/O error occurred during the retrieval
of the requested Part
javax.servlet.ServletException
- if this request is not of type
multipart/form-dataMultipartConfig.maxFileSize()
,
MultipartConfig.maxRequestSize()
public java.util.Collection<javax.servlet.http.Part> getParts() throws java.io.IOException, javax.servlet.ServletException
javax.servlet.http.HttpServletRequest
Part
components of this request, provided
that it is of type multipart/form-data.
If this request is of type multipart/form-data, but does not contain any Part components, the returned Collection will be empty.
Any changes to the returned Collection
must not
affect this HttpServletRequest
.
getParts
in interface javax.servlet.http.HttpServletRequest
Collection
of the
Part components of this request
java.io.IOException
- if an I/O error occurred during the retrieval
of the Part
components of this request
javax.servlet.ServletException
- if this request is not of type
multipart/form-dataMultipartConfig.maxFileSize()
,
MultipartConfig.maxRequestSize()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |