public interface HttpRequest extends java.io.Serializable, HttpServletRequest
Modifier and Type | Interface and Description |
---|---|
static class |
HttpRequest.Method
Request methods
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HEADER_ACCEPT
the Accept header
|
static java.lang.String |
HEADER_ACCEPT_ENCODING
the Accept-Encoding header
|
static java.lang.String |
HEADER_ACCEPT_LANGUAGE
the Accept-Language header
|
static java.lang.String |
HEADER_CACHE_CONTROL
the Cache-Control header
|
static java.lang.String |
HEADER_CONNECTION
the Connection header
|
static java.lang.String |
HEADER_CONTENT_LENGTH
the Content-Length header
|
static java.lang.String |
HEADER_CONTENT_TYPE
the Content-Type header
|
static java.lang.String |
HEADER_COOKIE
the Cookie header
|
static java.lang.String |
HEADER_HOST
the Host header
|
static java.lang.String |
HEADER_SET_COOKIE
the Set-Cookie header
|
static java.lang.String |
HEADER_USER_AGENT
the User-Agent header
|
static java.lang.String |
SERVLET_CONTEXT
If the https server implementation is based on Servlets, the real ServletContext
will be registered in the request attributes using this name.
|
static java.lang.String |
SERVLET_REQUEST
If the https server implementation is based on Servlets, the real HttpServletRequest
will be registered in the request attributes using this name.
|
static java.lang.String |
SERVLET_RESPONSE
If the https server implementation is based on Servlets, the real HttpServletResponse
will be registered in the request attributes using this name.
|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named attribute as an
Object ,
or null if no attribute of the given name exists. |
int |
getContentLength()
Returns the length, in bytes, of the request body and made available by
the input stream, or -1 if the length is not known ir is greater than
Integer.MAX_VALUE.
|
java.lang.String |
getContentType()
Returns the MIME type of the body of the request, or
null if the type is not known. |
java.lang.String |
getParameter(java.lang.String name)
Gets a form or URL query parameter based on the name passed in.
|
java.util.Map |
getParameters()
Gets all the form and URL query parameters
|
java.lang.String |
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client
or last proxy that sent the request.
|
java.net.URI |
getURI()
Gets the URI for the current URL page.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Stores an attribute in this request.
|
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLengthLong, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setCharacterEncoding, startAsync, startAsync
static final java.lang.String HEADER_ACCEPT
static final java.lang.String HEADER_ACCEPT_ENCODING
static final java.lang.String HEADER_ACCEPT_LANGUAGE
static final java.lang.String HEADER_CONTENT_TYPE
static final java.lang.String HEADER_CONTENT_LENGTH
static final java.lang.String HEADER_CONNECTION
static final java.lang.String HEADER_CACHE_CONTROL
static final java.lang.String HEADER_HOST
static final java.lang.String HEADER_USER_AGENT
static final java.lang.String HEADER_SET_COOKIE
static final java.lang.String HEADER_COOKIE
static final java.lang.String SERVLET_REQUEST
static final java.lang.String SERVLET_RESPONSE
static final java.lang.String SERVLET_CONTEXT
java.lang.String getParameter(java.lang.String name)
getParameter
in interface ServletRequest
name
- String
representing the single value of
the parameterServletRequest.getParameterValues(java.lang.String)
java.util.Map getParameters()
java.net.URI getURI()
int getContentLength()
ServletRequest
getContentLength
in interface ServletRequest
java.lang.String getContentType()
ServletRequest
null
if the type is not known. For HTTP servlets,
same as the value of the CGI variable CONTENT_TYPE.getContentType
in interface ServletRequest
String
containing the name of the MIME type
of the request, or null if the type is not knownjava.lang.Object getAttribute(java.lang.String name)
ServletRequest
Object
,
or null
if no attribute of the given name exists.
Attributes can be set two ways. The servlet container may set
attributes to make available custom information about a request.
For example, for requests made using HTTPS, the attribute
javax.servlet.request.X509Certificate
can be used to
retrieve information on the certificate of the client. Attributes
can also be set programatically using
ServletRequest.setAttribute(java.lang.String, java.lang.Object)
. This allows information to be
embedded into a request before a RequestDispatcher
call.
Attribute names should follow the same conventions as package
names. This specification reserves names matching java.*
,
javax.*
, and sun.*
.
getAttribute
in interface ServletRequest
name
- a String
specifying the name of the attributeObject
containing the value of the attribute,
or null
if the attribute does not existvoid setAttribute(java.lang.String name, java.lang.Object value)
ServletRequest
RequestDispatcher
.
Attribute names should follow the same conventions as
package names.
If the object passed in is null, the effect is the same as
calling ServletRequest.removeAttribute(java.lang.String)
.
It is warned that when the request is dispatched from the
servlet resides in a different web application by
RequestDispatcher
, the object set by this method
may not be correctly retrieved in the caller servlet.
setAttribute
in interface ServletRequest
name
- a String
specifying
the name of the attributevalue
- the Object
to be storedjava.lang.String getRemoteAddr()
ServletRequest
REMOTE_ADDR
.getRemoteAddr
in interface ServletRequest
String
containing the
IP address of the client that sent the request