- All Superinterfaces:
ServletRequest
- All Known Subinterfaces:
WebApplicationRequest
- All Known Implementing Classes:
AsyncHttpDispatchWrapper
,DefaultWebApplicationRequest
,EmbeddedRequest
,HttpServletRequestWrapper
,HttpWebApplicationRequest
,NanoRequest
,RealtimeHttpServletRequestWrapper
,WeldHttpServletRequest
The HttpServletRequest API.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
authenticate
(HttpServletResponse response) Authenticate the request.Change the session id.Returns the auth type.Returns the context path.Cookie[]
Get the cookies.long
getDateHeader
(String name) Get the date header.Get the header.Returns the header names.getHeaders
(String name) Returns the headers.default HttpServletMapping
Returns the HTTP servlet mapping.int
getIntHeader
(String name) Get the int header.Returns the HTTP method.Get the part.getParts()
Get the parts.Returns the path info.Returns the path translated.Get the query string.Get the remote user.Returns the requested session id.Returns the request URI.Returns the request URL.Returns the servlet path.Returns the HTTP session.getSession
(boolean create) Get the HTTP session.Returns the trailer fields.Returns the user principal.boolean
Is the requested session id from a cookie.boolean
Deprecated.boolean
Is the requested session id from a URL.boolean
Is the requested session id valid.default boolean
Is trailer fields ready.boolean
isUserInRole
(String role) Is the user in the specified role.void
Login.void
logout()
Logout.default PushBuilder
Create a new push builder.<T extends HttpUpgradeHandler>
TUpgrade the request.Methods inherited from interface jakarta.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Field Details
-
BASIC_AUTH
Defines the BASIC_AUTH constant.- See Also:
-
CLIENT_CERT_AUTH
Defines the CLIENT_CERT constant.- See Also:
-
DIGEST_AUTH
Defines the DIGEST constant.- See Also:
-
FORM_AUTH
Defines the FORM constant.- See Also:
-
-
Method Details
-
authenticate
Authenticate the request.- Parameters:
response
- the response.- Returns:
- true if authenticated, false otherwise.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
changeSessionId
String changeSessionId()Change the session id.- Returns:
- the new session id.
-
getAuthType
String getAuthType()Returns the auth type.- Returns:
- the auth type
-
getContextPath
String getContextPath()Returns the context path.- Returns:
- the context path
-
getCookies
Cookie[] getCookies()Get the cookies.- Returns:
- the cookies, or null if none.
-
getDateHeader
Get the date header.- Parameters:
name
- the name.- Returns:
- the date, or -1 if not found.
-
getHeader
Get the header.- Parameters:
name
- the name.- Returns:
- the header, or null if not found.
-
getHeaders
Returns the headers.- Parameters:
name
- the name.- Returns:
- the headers
-
getHeaderNames
Enumeration<String> getHeaderNames()Returns the header names.- Returns:
- the header names
-
getHttpServletMapping
Returns the HTTP servlet mapping.- Returns:
- the HTTP servlet mapping
-
getIntHeader
Get the int header.- Parameters:
name
- the name.- Returns:
- the header, or -1 if not found.
-
getMethod
String getMethod()Returns the HTTP method.- Returns:
- the HTTP method
-
getPart
Get the part.- Parameters:
name
- the name.- Returns:
- the part, or null if not found.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
getParts
Get the parts.- Returns:
- the parts.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
getPathInfo
String getPathInfo()Returns the path info.- Returns:
- the path info
-
getPathTranslated
String getPathTranslated()Returns the path translated.- Returns:
- the path translated
-
getQueryString
String getQueryString()Get the query string.- Returns:
- the query string, or null if not found.
-
getRemoteUser
String getRemoteUser()Get the remote user.- Returns:
- the remote user, or null if not found.
-
getRequestURI
String getRequestURI()Returns the request URI.- Returns:
- the request URI
-
getRequestURL
StringBuffer getRequestURL()Returns the request URL.- Returns:
- the request URL
-
getRequestedSessionId
String getRequestedSessionId()Returns the requested session id.- Returns:
- the requested session id
-
getServletPath
String getServletPath()Returns the servlet path.- Returns:
- the servlet path
-
getSession
Get the HTTP session.- Parameters:
create
- the create flag.- Returns:
- the HTTP session, or null if not found and create flag is false.
-
getSession
HttpSession getSession()Returns the HTTP session.- Returns:
- the HTTP session
-
getTrailerFields
Returns the trailer fields.- Returns:
- the trailer fields
-
getUserPrincipal
Principal getUserPrincipal()Returns the user principal.- Returns:
- the user principal
-
isRequestedSessionIdFromCookie
boolean isRequestedSessionIdFromCookie()Is the requested session id from a cookie.- Returns:
- true if it is, false otherwise.
-
isRequestedSessionIdFromURL
boolean isRequestedSessionIdFromURL()Is the requested session id from a URL.- Returns:
- true if it is, false otherwise.
-
isRequestedSessionIdFromUrl
Deprecated.Is the requested session id from a URL.- Returns:
- true if it is, false otherwise.
-
isRequestedSessionIdValid
boolean isRequestedSessionIdValid()Is the requested session id valid.- Returns:
- true if it is, false otherwise.
-
isTrailerFieldsReady
default boolean isTrailerFieldsReady()Is trailer fields ready.- Returns:
- true if fields are ready, false otherwise.
-
isUserInRole
Is the user in the specified role.- Parameters:
role
- the role.- Returns:
- true if the user is in the specified role, false otherwise.
-
login
Login.- Parameters:
username
- the username.password
- the password.- Throws:
ServletException
- when a Servlet error occurs.
-
logout
Logout.- Throws:
ServletException
- when a Servlet error occurs.
-
newPushBuilder
Create a new push builder.- Returns:
- the push builder.
-
upgrade
<T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException Upgrade the request.- Type Parameters:
T
- the type of HTTP upgrade handler.- Parameters:
handlerClass
- the handler class.- Returns:
- the HTTP upgrade handler.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-