public class Request extends java.lang.Object implements HttpServletRequest
Modifier and Type | Field and Description |
---|---|
protected java.lang.Boolean |
asyncSupported |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Object> |
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 |
comet
Comet state (can be accessed from multiple threads concurrently).
|
protected Connector |
connector
Associated Catalina connector.
|
protected Cookie[] |
cookies
The set of cookies associated with this Request.
|
protected boolean |
cookiesConverted
Cookie parsed flag.
|
protected boolean |
cookiesParsed
Cookie headers parsed flag.
|
protected Request |
coyoteRequest
Coyote request.
|
protected static java.util.Locale |
defaultLocale
The default Locale if none are specified.
|
protected CometEventImpl |
event
Associated event.
|
protected RequestFacade |
facade
The facade associated with this request.
|
protected FilterChain |
filterChain
Filter chain 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 InputBuffer |
inputBuffer
The associated input buffer.
|
protected CoyoteInputStream |
inputStream
ServletInputStream.
|
protected DispatcherType |
internalDispatcherType
The current dispatcher type.
|
protected java.lang.String |
localAddr
Local address
|
protected java.util.ArrayList<java.util.Locale> |
locales
The preferred Locales associated 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<java.lang.String,java.lang.String[]> |
parameterMap
Hash map used in the getParametersMap method.
|
protected boolean |
parametersParsed
Request parameters parsed flag.
|
protected java.util.Collection<Part> |
parts
The parts, if any, uploaded with this request.
|
protected java.lang.Exception |
partsParseException
The exception thrown, if any when parsing the parts.
|
protected java.util.Map<java.lang.String,java.lang.String> |
pathParameters
Path parameters
|
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 |
requestedSessionSSL
Was the requested session ID obtained from the SSL session?
|
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 StringManager |
sm
The string manager for this package.
|
protected boolean |
sslAttributesParsed
Flag that indicates if SSL attributes have been parsed to improve
performance for applications (usually frameworks) that make multiple
calls to
getAttributeNames() . |
protected javax.security.auth.Subject |
subject
The Subject associated with the current AccessControlContext
|
protected B2CConverter |
URIConverter
URI byte to char converter.
|
protected java.security.Principal |
userPrincipal
User principal.
|
protected boolean |
usingInputStream
Using stream flag.
|
protected boolean |
usingReader
Using writer flag.
|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
Constructor and Description |
---|
Request() |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request.
|
void |
addLocale(java.util.Locale locale)
Add a Locale to the set of preferred Locales for this Request.
|
protected void |
addPathParameter(java.lang.String name,
java.lang.String value) |
boolean |
authenticate(HttpServletResponse response)
Triggers the same authentication process as would be triggered if the
request is for a resource that is protected by a security constraint.
|
java.lang.String |
changeSessionId()
Changes the session ID of the session associated with this request.
|
void |
changeSessionId(java.lang.String newSessionId)
Change the ID of the session that this request is associated with.
|
protected void |
checkSwallowInput()
Disable swallowing of remaining input if configured
|
void |
clearCookies()
Clear the collection of Cookies associated with this Request.
|
void |
clearEncoders()
Clear cached encoders (to save memory for Comet requests).
|
void |
clearLocales()
Clear the collection of Locales associated with this Request.
|
void |
cometClose() |
protected void |
convertCookies()
Converts the parsed cookies (parsing the Cookie headers first if they
have not been parsed) into Cookie objects.
|
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.
|
AsyncContext |
getAsyncContext()
Get the current AsyncContext.
|
AsyncContextImpl |
getAsyncContextInternal() |
java.lang.Object |
getAttribute(java.lang.String name)
Return the specified request attribute if it exists; otherwise, return
null . |
java.util.Enumeration<java.lang.String> |
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 |
getAvailable()
Return true if bytes are available.
|
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.
|
long |
getContentLengthLong()
Returns the length, in bytes, of the request body and made available by
the input stream, or -1 if the length is not known.
|
java.lang.String |
getContentType()
Return the content type for this Request.
|
Context |
getContext()
Return the Context within which this Request is being processed.
|
java.lang.String |
getContextPath()
Return the portion of the request URI used to select the Context
of the Request.
|
Cookie[] |
getCookies()
Return the set of Cookies received with this Request.
|
Request |
getCoyoteRequest()
Get the Coyote request.
|
long |
getDateHeader(java.lang.String name)
Return the value of the specified date header, if any; otherwise
return -1.
|
java.lang.String |
getDecodedRequestURI()
Get the decoded request URI.
|
MessageBytes |
getDecodedRequestURIMB()
Get the decoded request URI.
|
DispatcherType |
getDispatcherType() |
CometEventImpl |
getEvent()
Get the event associated with the request.
|
FilterChain |
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<java.lang.String> |
getHeaderNames()
Return the names of all headers received with this request.
|
java.util.Enumeration<java.lang.String> |
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.
|
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<java.util.Locale> |
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.lang.String |
getParameter(java.lang.String name)
Return the value of the specified request parameter, if any; otherwise,
return
null . |
java.util.Map<java.lang.String,java.lang.String[]> |
getParameterMap()
Returns a
Map of the parameters of this request. |
java.util.Enumeration<java.lang.String> |
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 . |
Part |
getPart(java.lang.String name)
Gets the named Part or null if the Part does not exist.
|
java.util.Collection<Part> |
getParts()
Return a collection of all uploaded Parts.
|
java.lang.String |
getPathInfo()
Return the path information associated with this Request.
|
protected java.lang.String |
getPathParameter(java.lang.String name) |
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.
|
HttpServletRequest |
getRequest()
Return the
ServletRequest for which this object
is the facade. |
RequestDispatcher |
getRequestDispatcher(java.lang.String path)
Return a RequestDispatcher that wraps the resource at the specified
path, which may be interpreted as relative to the current request path.
|
java.lang.String |
getRequestedSessionId()
Return the session identifier included in this request, if any.
|
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.
|
java.lang.String |
getScheme()
Return the scheme used to make this Request.
|
ServerCookies |
getServerCookies()
Return the server representation of the cookies associated with this
request.
|
java.lang.String |
getServerName()
Return the server name responding to this Request.
|
int |
getServerPort()
Return the server port responding to this Request.
|
ServletContext |
getServletContext() |
java.lang.String |
getServletPath()
Return the portion of the request URI used to select the servlet
that will process this request.
|
HttpSession |
getSession()
Return the session associated with this Request, creating one
if necessary.
|
HttpSession |
getSession(boolean create)
Return the session associated with this Request, creating one
if necessary and requested.
|
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 |
isAsync() |
boolean |
isAsyncCompleting() |
boolean |
isAsyncDispatching() |
boolean |
isAsyncStarted() |
boolean |
isAsyncSupported() |
boolean |
isComet()
Return true if the current request is handling Comet traffic.
|
boolean |
isFinished()
Return true if an attempt has been made to read the request body and all
of the request body has been read
|
boolean |
isParametersParsed()
return true if we have parsed parameters
|
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)
Authenticate the provided user name and password and then associated the
authenticated user with the request.
|
void |
logout()
Removes any authenticated user from the request.
|
protected void |
parseCookies()
Parse cookies.
|
protected void |
parseLocales()
Parse request locales.
|
protected void |
parseLocalesHeader(java.lang.String value,
java.util.TreeMap<java.lang.Double,java.util.ArrayList<java.util.Locale>> locales)
Parse accept-language header value.
|
protected void |
parseParameters()
Parse request parameters.
|
boolean |
read() |
protected byte[] |
readChunkedPostBody()
Read chunked post body.
|
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.
|
protected void |
recycleCookieInfo(boolean recycleCoyote) |
protected void |
recycleSessionInfo() |
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 |
setAsyncSupported(boolean asyncSupported) |
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 |
setCharacterEncoding(java.lang.String enc)
Overrides the name of the character encoding used in the body of
this request.
|
void |
setComet(boolean comet)
Set comet state.
|
void |
setCometTimeout(long timeout) |
void |
setConnector(Connector connector)
Set the Connector through which this Request was received.
|
void |
setContentType(java.lang.String contentType)
Set the content type for this Request.
|
void |
setContext(Context context)
Deprecated.
Use setters on
MappingData object.
Depending on use case, you may need to update other
MappingData fields as well, such as
contextSlashCount and host . |
void |
setCoyoteRequest(Request coyoteRequest)
Set the Coyote request.
|
void |
setFilterChain(FilterChain filterChain)
Set filter chain associated with the request.
|
void |
setLocalPort(int port)
Set the port number of the server to process 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 |
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 |
setRequestedSessionSSL(boolean flag)
Set a flag indicating whether or not the requested session ID for this
request came in through SSL.
|
void |
setRequestedSessionURL(boolean flag)
Set a flag indicating whether or not the requested session ID for this
request came in through a URL.
|
void |
setResponse(Response response)
Set the Response with which this Request is associated.
|
void |
setSecure(boolean secure)
Set the value to be returned by
isSecure()
for this Request. |
void |
setServerPort(int port)
Set the port number of the server to process 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)
Deprecated.
Use setters on
MappingData object.
Depending on use case, you may need to update other
MappingData fields as well, such as context
and contextSlashCount . |
AsyncContext |
startAsync() |
AsyncContext |
startAsync(ServletRequest request,
ServletResponse response) |
protected java.lang.String |
unescape(java.lang.String s) |
<T extends HttpUpgradeHandler> |
upgrade(java.lang.Class<T> httpUpgradeHandlerClass)
Start the HTTP upgrade process and pass the connection to the provided
protocol handler once the current request/response pair has completed
processing.
|
protected Request coyoteRequest
protected static final java.util.TimeZone GMT_ZONE
protected static final StringManager sm
protected Cookie[] cookies
protected final java.text.SimpleDateFormat[] formats
protected static final java.util.Locale defaultLocale
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Object> attributes
protected boolean sslAttributesParsed
getAttributeNames()
.protected final java.util.ArrayList<java.util.Locale> locales
protected java.lang.String authType
protected CometEventImpl event
protected volatile boolean comet
protected DispatcherType internalDispatcherType
protected final InputBuffer inputBuffer
protected CoyoteInputStream inputStream
protected CoyoteReader reader
protected boolean usingInputStream
protected boolean usingReader
protected java.security.Principal userPrincipal
protected boolean parametersParsed
protected boolean cookiesParsed
protected boolean cookiesConverted
protected boolean secure
protected transient javax.security.auth.Subject subject
protected static final int CACHED_POST_LEN
protected byte[] postData
protected ParameterMap<java.lang.String,java.lang.String[]> parameterMap
protected java.util.Collection<Part> parts
protected java.lang.Exception partsParseException
protected Session session
protected java.lang.Object requestDispatcherPath
protected boolean requestedSessionCookie
protected java.lang.String requestedSessionId
protected boolean requestedSessionURL
protected boolean requestedSessionSSL
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 java.lang.Boolean asyncSupported
protected final java.util.Map<java.lang.String,java.lang.String> pathParameters
protected Connector connector
protected FilterChain filterChain
protected final MappingData mappingData
protected RequestFacade facade
protected Response response
protected B2CConverter URIConverter
public void setCoyoteRequest(Request coyoteRequest)
coyoteRequest
- The Coyote requestpublic Request getCoyoteRequest()
protected void addPathParameter(java.lang.String name, java.lang.String value)
protected java.lang.String getPathParameter(java.lang.String name)
public void setAsyncSupported(boolean asyncSupported)
public void recycle()
public void clearEncoders()
protected void recycleSessionInfo()
protected void recycleCookieInfo(boolean recycleCoyote)
public boolean read() throws java.io.IOException
java.io.IOException
public Connector getConnector()
public void setConnector(Connector connector)
connector
- The new connectorpublic Context getContext()
This is available as soon as the appropriate Context is identified.
Note that availability of a Context allows getContextPath()
to return a value, and thus enables parsing of the request URI.
@Deprecated public void setContext(Context context)
MappingData
object.
Depending on use case, you may need to update other
MappingData
fields as well, such as
contextSlashCount
and host
.context
- The newly associated Contextpublic FilterChain getFilterChain()
public void setFilterChain(FilterChain filterChain)
filterChain
- new filter chainpublic Host getHost()
public MappingData getMappingData()
public HttpServletRequest getRequest()
ServletRequest
for which this object
is the facade. This method must be implemented by a subclass.public Response getResponse()
public void setResponse(Response response)
response
- The new associated responsepublic java.io.InputStream getStream()
protected B2CConverter getURIConverter()
protected void setURIConverter(B2CConverter URIConverter)
URIConverter
- the new URI converterpublic Wrapper getWrapper()
@Deprecated public void setWrapper(Wrapper wrapper)
MappingData
object.
Depending on use case, you may need to update other
MappingData
fields as well, such as context
and contextSlashCount
.wrapper
- The newly associated Wrapperpublic ServletInputStream createInputStream() throws java.io.IOException
java.io.IOException
- if an input/output error occurspublic void finishRequest() throws java.io.IOException
java.io.IOException
- if an input/output error occurspublic java.lang.Object getNote(java.lang.String name)
null
if no such binding exists.name
- Name of the note to be returnedpublic void removeNote(java.lang.String name)
name
- Name of the note to be removedpublic void setLocalPort(int port)
port
- The server portpublic 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 setRemoteAddr(java.lang.String remoteAddr)
remoteAddr
- The remote IP addresspublic void setRemoteHost(java.lang.String remoteHost)
remoteHost
- The remote host namepublic void setSecure(boolean secure)
isSecure()
for this Request.secure
- The new isSecure valuepublic void setServerPort(int port)
port
- The server portpublic java.lang.Object getAttribute(java.lang.String name)
null
.getAttribute
in interface ServletRequest
name
- Name of the request attribute to returnObject
containing the value of the attribute, or
null
if the attribute does not existpublic long getContentLengthLong()
javax.servlet.ServletRequest
getContentLengthLong
in interface ServletRequest
public java.util.Enumeration<java.lang.String> getAttributeNames()
Enumeration
if there are none. Note that the attribute
names returned will only be those for the attributes set via
setAttribute(String, Object)
. Tomcat internal attributes will
not be included although they are accessible via
getAttribute(String)
. The Tomcat internal attributes include:
Globals.DISPATCHER_TYPE_ATTR
Globals.DISPATCHER_REQUEST_PATH_ATTR
Globals.ASYNC_SUPPORTED_ATTR
Globals.CERTIFICATES_ATTR
(SSL connections only)Globals.CIPHER_SUITE_ATTR
(SSL connections only)Globals.KEY_SIZE_ATTR
(SSL connections only)Globals.SSL_SESSION_ID_ATTR
(SSL connections only)Globals.SSL_SESSION_MGR_ATTR
(SSL connections only)Globals.PARAMETER_PARSE_FAILED_ATTR
getAttributeNames
in interface ServletRequest
Enumeration
of strings containing the names of the
request's attributespublic java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface 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 ServletRequest
Integer.MAX_VALUE
public java.lang.String getContentType()
getContentType
in interface ServletRequest
String
containing the name of the MIME type of the
request, or null if the type is not knownpublic void setContentType(java.lang.String contentType)
public ServletInputStream getInputStream() throws java.io.IOException
createInputStream()
.getInputStream
in interface ServletRequest
ServletInputStream
object containing the body of the
requestjava.lang.IllegalStateException
- if getReader()
has
already been called for this requestjava.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 ServletRequest
Locale
for the clientpublic java.util.Enumeration<java.util.Locale> 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 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 ServletRequest
name
- Name of the desired request parameterString
representing the single value of the
parameterServletRequest.getParameterValues(java.lang.String)
public java.util.Map<java.lang.String,java.lang.String[]> 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 ServletRequest
Map
containing parameter names as keys
and parameter values as map values.public java.util.Enumeration<java.lang.String> getParameterNames()
getParameterNames
in interface 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 ServletRequest
name
- Name of the desired request parameterString
objects containing the parameter's
valuesServletRequest.getParameter(java.lang.String)
public java.lang.String getProtocol()
getProtocol
in interface 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 ServletRequest
BufferedReader
containing the body of the requestjava.lang.IllegalStateException
- if getInputStream()
has already been called for this requestjava.io.IOException
- if an input/output error occursServletRequest.getInputStream()
@Deprecated public java.lang.String getRealPath(java.lang.String path)
ServletContext.getRealPath()
.getRealPath
in interface ServletRequest
path
- Path to be translatedServletContext.getRealPath(String)
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
String
containing the IP address of the client
that sent the requestpublic java.lang.String getRemoteHost()
getRemoteHost
in interface ServletRequest
String
containing the fully qualified name of the
clientpublic int getRemotePort()
getRemotePort
in interface ServletRequest
public java.lang.String getLocalName()
getLocalName
in interface ServletRequest
String
containing the host name of the IP on which
the request was received.public java.lang.String getLocalAddr()
getLocalAddr
in interface ServletRequest
String
containing the IP address on which the
request was received.public int getLocalPort()
getLocalPort
in interface ServletRequest
public RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface ServletRequest
path
- Path of the resource to be wrappedRequestDispatcher
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 ServletRequest
String
containing the name of the scheme used to
make this requestpublic java.lang.String getServerName()
getServerName
in interface ServletRequest
String
containing the name of the serverpublic int getServerPort()
getServerPort
in interface ServletRequest
public boolean isSecure()
isSecure
in interface ServletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface ServletRequest
name
- Name of the request attribute to removepublic void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface 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 ServletRequest
enc
- The character encoding to be usedjava.io.UnsupportedEncodingException
- if the specified encoding
is not supportedpublic ServletContext getServletContext()
getServletContext
in interface ServletRequest
public AsyncContext startAsync()
startAsync
in interface ServletRequest
public AsyncContext startAsync(ServletRequest request, ServletResponse response)
startAsync
in interface ServletRequest
request
- The ServletRequest with which to initialise the
asynchronous contextresponse
- The ServletResponse with which to initialise the
asynchronous contextpublic boolean isAsyncStarted()
isAsyncStarted
in interface ServletRequest
public boolean isAsyncDispatching()
public boolean isAsyncCompleting()
public boolean isAsync()
public boolean isAsyncSupported()
isAsyncSupported
in interface ServletRequest
public AsyncContext getAsyncContext()
javax.servlet.ServletRequest
getAsyncContext
in interface ServletRequest
public AsyncContextImpl getAsyncContextInternal()
public DispatcherType getDispatcherType()
getDispatcherType
in interface ServletRequest
public void addCookie(Cookie cookie)
cookie
- The new cookiepublic void addLocale(java.util.Locale locale)
locale
- The new preferred Localepublic void clearCookies()
public void clearLocales()
public void setAuthType(java.lang.String type)
null
. Typical values are "BASIC",
"DIGEST", or "SSL".type
- The authentication type usedpublic 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 setRequestedSessionSSL(boolean flag)
flag
- The new flagpublic java.lang.String getDecodedRequestURI()
public MessageBytes getDecodedRequestURIMB()
public void setUserPrincipal(java.security.Principal principal)
getRemoteUser()
method.principal
- The user Principalpublic <T extends HttpUpgradeHandler> T upgrade(java.lang.Class<T> httpUpgradeHandlerClass) throws java.io.IOException, ServletException
HttpServletResponse.SC_SWITCHING_PROTOCOLS
and flushes the response.
Protocol specific headers must have already been set before this method
is called.upgrade
in interface HttpServletRequest
T
- The type of the upgrade handlerhttpUpgradeHandlerClass
- The class that implements the upgrade
handlerjava.io.IOException
- if an I/O error occurred during the upgradeServletException
- if the given httpUpgradeHandlerClass fails to be instantiatedpublic java.lang.String getAuthType()
getAuthType
in interface HttpServletRequest
null
if the request was not authenticated.public java.lang.String getContextPath()
getContextPath
in interface HttpServletRequest
String
specifying the portion of the request URI
that indicates the context of the requestpublic Cookie[] getCookies()
getCookies
in interface HttpServletRequest
Cookies
included with this
request, or null
if the request has no cookiespublic ServerCookies getServerCookies()
public long getDateHeader(java.lang.String name)
getDateHeader
in interface HttpServletRequest
name
- Name of the requested date headerlong
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
requestjava.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 HttpServletRequest
name
- Name of the requested headerString
containing the value of the requested
header, or null
if the request does not have a
header of that namepublic java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)
getHeaders
in interface HttpServletRequest
name
- Name of the requested headerEnumeration
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<java.lang.String> getHeaderNames()
getHeaderNames
in interface HttpServletRequest
null
public int getIntHeader(java.lang.String name)
getIntHeader
in interface HttpServletRequest
name
- Name of the requested headerjava.lang.IllegalArgumentException
- if the specified header value
cannot be converted to an integerpublic java.lang.String getMethod()
getMethod
in interface HttpServletRequest
String
specifying the name of the method with
which this request was madepublic java.lang.String getPathInfo()
getPathInfo
in interface 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 java.lang.String getPathTranslated()
getPathTranslated
in interface 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 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 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 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 HttpServletRequest
String
containing the part of the URL from the
protocol name up to the query stringHttpServletRequest.getRequestURL()
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 HttpServletRequest
StringBuffer
object containing the
reconstructed URLpublic java.lang.String getServletPath()
getServletPath
in interface 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 HttpSession getSession()
getSession
in interface HttpServletRequest
HttpSession
associated with this requestHttpServletRequest.getSession(boolean)
public HttpSession getSession(boolean create)
getSession
in interface HttpServletRequest
create
- Create a new session if one does not existHttpSession
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 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 HttpServletRequest
true
if the session ID came in as part of a URL;
otherwise, false
HttpServletRequest.getSession(boolean)
@Deprecated public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromURL()
instead.true
if the session identifier included in this
request came from the request URI.isRequestedSessionIdFromUrl
in interface HttpServletRequest
HttpServletRequest.isRequestedSessionIdFromURL()
public boolean isRequestedSessionIdValid()
true
if the session identifier included in this
request identifies a valid session.isRequestedSessionIdValid
in interface HttpServletRequest
true
if this request has an id for a valid session
in the current session context; false
otherwiseHttpServletRequest.getRequestedSessionId()
,
HttpServletRequest.getSession(boolean)
public boolean isUserInRole(java.lang.String role)
true
if the authenticated user principal
possesses the specified role name.isUserInRole
in interface HttpServletRequest
role
- Role name to be validatedboolean
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 HttpServletRequest
java.security.Principal
containing the name of the
user making this request; null
if the user has not
been authenticatedpublic Session getSessionInternal()
public void changeSessionId(java.lang.String newSessionId)
newSessionId
- The session to change the session ID forpublic java.lang.String changeSessionId()
changeSessionId
in interface HttpServletRequest
HttpSessionIdListener
public Session getSessionInternal(boolean create)
create
- Create a new session if one does not existpublic CometEventImpl getEvent()
public boolean isComet()
public void setComet(boolean comet)
public boolean isParametersParsed()
public boolean getAvailable()
public boolean isFinished()
protected void checkSwallowInput()
public void cometClose()
public void setCometTimeout(long timeout)
public boolean authenticate(HttpServletResponse response) throws java.io.IOException, ServletException
javax.servlet.http.HttpServletRequest
authenticate
in interface HttpServletRequest
response
- The response to use to return any authentication
challengetrue
if the user is successfully authenticated and
false
if notjava.io.IOException
- If an I/O error occursjava.lang.IllegalStateException
- If the response has been committedServletException
- If the caller is responsible for handling the
error and the container has NOT set the HTTP response code etc.public void login(java.lang.String username, java.lang.String password) throws ServletException
login
in interface HttpServletRequest
username
- The user name to authenticatepassword
- The password to use to authenticate the userServletException
- If any of HttpServletRequest.getRemoteUser()
,
HttpServletRequest.getUserPrincipal()
or HttpServletRequest.getAuthType()
are
non-null, if the configured authenticator does not support
user name and password authentication or if the
authentication failspublic void logout() throws ServletException
logout
in interface HttpServletRequest
ServletException
- If the logout failspublic java.util.Collection<Part> getParts() throws java.io.IOException, java.lang.IllegalStateException, ServletException
getParts
in interface HttpServletRequest
java.io.IOException
- if an I/O error occursjava.lang.IllegalStateException
- if size limits are exceeded or no multipart configuration is
providedServletException
- if the request is not multipart/form-datapublic Part getPart(java.lang.String name) throws java.io.IOException, java.lang.IllegalStateException, ServletException
getPart
in interface HttpServletRequest
name
- The name of the Part to obtainjava.io.IOException
- if an I/O error occursjava.lang.IllegalStateException
- if size limits are exceededServletException
- if the request is not multipart/form-dataprotected Session doGetSession(boolean create)
protected java.lang.String unescape(java.lang.String s)
protected void parseCookies()
protected void convertCookies()
protected void parseParameters()
protected int readPostBody(byte[] body, int len) throws java.io.IOException
java.io.IOException
protected byte[] readChunkedPostBody() throws java.io.IOException
java.io.IOException
protected void parseLocales()
protected void parseLocalesHeader(java.lang.String value, java.util.TreeMap<java.lang.Double,java.util.ArrayList<java.util.Locale>> locales)
protected static final boolean isAlpha(java.lang.String value)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.