- All Superinterfaces:
ServletRequest
- All Known Subinterfaces:
WebApplicationRequest
,WebApplicationServerRequest
- All Known Implementing Classes:
AsyncHttpDispatchWrapper
,DefaultWebApplicationRequest
,DefaultWebApplicationServerRequest
,EmbeddedRequest
,HttpServletRequestWrapper
,NanoRequest
,RealtimeHttpServletRequestWrapper
,WeldHttpServletRequest
public interface HttpServletRequest extends ServletRequest
The HttpServletRequest API.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BASIC_AUTH
Defines the BASIC_AUTH constant.static java.lang.String
CLIENT_CERT_AUTH
Defines the CLIENT_CERT constant.static java.lang.String
DIGEST_AUTH
Defines the DIGEST constant.static java.lang.String
FORM_AUTH
Defines the FORM constant. -
Method Summary
Modifier and Type Method Description boolean
authenticate(HttpServletResponse response)
Authenticate the request.java.lang.String
changeSessionId()
Change the session id.java.lang.String
getAuthType()
Get the auth type.java.lang.String
getContextPath()
Get the context path.Cookie[]
getCookies()
Get the cookies.long
getDateHeader(java.lang.String name)
Get the date header.java.lang.String
getHeader(java.lang.String name)
Get the header.java.util.Enumeration<java.lang.String>
getHeaderNames()
Get the header names.java.util.Enumeration<java.lang.String>
getHeaders(java.lang.String name)
Get the headers.default HttpServletMapping
getHttpServletMapping()
Get the HTTP servlet mapping.int
getIntHeader(java.lang.String name)
Get the int header.java.lang.String
getMethod()
Get the HTTP method.Part
getPart(java.lang.String name)
Get the part.java.util.Collection<Part>
getParts()
Get the parts.java.lang.String
getPathInfo()
Get the path info.java.lang.String
getPathTranslated()
Get the path translated.java.lang.String
getQueryString()
Get the query string.java.lang.String
getRemoteUser()
Get the remote user.java.lang.String
getRequestedSessionId()
Get the requested session id.java.lang.String
getRequestURI()
Get the request URI.java.lang.StringBuffer
getRequestURL()
Get the request URL.java.lang.String
getServletPath()
Get the servlet path.HttpSession
getSession()
Get the HTTP session.HttpSession
getSession(boolean create)
Get the HTTP session.default java.util.Map<java.lang.String,java.lang.String>
getTrailerFields()
Get the trailer fields.java.security.Principal
getUserPrincipal()
Get the user principal.boolean
isRequestedSessionIdFromCookie()
Is the requested session id from a cookie.boolean
isRequestedSessionIdFromUrl()
Deprecated.boolean
isRequestedSessionIdFromURL()
Is the requested session id from a URL.boolean
isRequestedSessionIdValid()
Is the requested session id valid.default boolean
isTrailerFieldsReady()
Is trailer fields ready.boolean
isUserInRole(java.lang.String role)
Is the user in the specified role.void
login(java.lang.String username, java.lang.String password)
Login.void
logout()
Logout.default PushBuilder
newPushBuilder()
Create a new push builder.<T extends HttpUpgradeHandler>
Tupgrade(java.lang.Class<T> handlerClass)
Upgrade the request.Methods inherited from interface javax.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
static final java.lang.String BASIC_AUTHDefines the BASIC_AUTH constant.- See Also:
- Constant Field Values
-
CLIENT_CERT_AUTH
static final java.lang.String CLIENT_CERT_AUTHDefines the CLIENT_CERT constant.- See Also:
- Constant Field Values
-
DIGEST_AUTH
static final java.lang.String DIGEST_AUTHDefines the DIGEST constant.- See Also:
- Constant Field Values
-
FORM_AUTH
static final java.lang.String FORM_AUTHDefines the FORM constant.- See Also:
- Constant Field Values
-
-
Method Details
-
authenticate
Authenticate the request.- Parameters:
response
- the response.- Returns:
- true if authenticated, false otherwise.
- Throws:
java.io.IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
changeSessionId
java.lang.String changeSessionId()Change the session id.- Returns:
- the new session id.
-
getAuthType
java.lang.String getAuthType()Get the auth type.- Returns:
- the auth type.
-
getContextPath
java.lang.String getContextPath()Get the context path.- Returns:
- the context path.
-
getCookies
Cookie[] getCookies()Get the cookies.- Returns:
- the cookies, or null if none.
-
getDateHeader
long getDateHeader(java.lang.String name)Get the date header.- Parameters:
name
- the name.- Returns:
- the date, or -1 if not found.
-
getHeader
java.lang.String getHeader(java.lang.String name)Get the header.- Parameters:
name
- the name.- Returns:
- the header, or null if not found.
-
getHeaders
java.util.Enumeration<java.lang.String> getHeaders(java.lang.String name)Get the headers.- Parameters:
name
- the name.- Returns:
- the headers.
-
getHeaderNames
java.util.Enumeration<java.lang.String> getHeaderNames()Get the header names.- Returns:
- the header names.
-
getHttpServletMapping
Get the HTTP servlet mapping.- Returns:
- the HTTP servlet mapping.
-
getIntHeader
int getIntHeader(java.lang.String name)Get the int header.- Parameters:
name
- the name.- Returns:
- the header, or -1 if not found.
-
getMethod
java.lang.String getMethod()Get the HTTP method.- Returns:
- the HTTP method.
-
getPart
Get the part.- Parameters:
name
- the name.- Returns:
- the part, or null if not found.
- Throws:
java.io.IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
getParts
Get the parts.- Returns:
- the parts.
- Throws:
java.io.IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
getPathInfo
java.lang.String getPathInfo()Get the path info.- Returns:
- the path info.
-
getPathTranslated
java.lang.String getPathTranslated()Get the path translated.- Returns:
- the path translated.
-
getQueryString
java.lang.String getQueryString()Get the query string.- Returns:
- the query string, or null if not found.
-
getRemoteUser
java.lang.String getRemoteUser()Get the remote user.- Returns:
- the remote user, or null if not found.
-
getRequestURI
java.lang.String getRequestURI()Get the request URI.- Returns:
- the request URI.
-
getRequestURL
java.lang.StringBuffer getRequestURL()Get the request URL.- Returns:
- the request URL.
-
getRequestedSessionId
java.lang.String getRequestedSessionId()Get the requested session id.- Returns:
- the requested session id.
-
getServletPath
java.lang.String getServletPath()Get 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()Get the HTTP session.- Returns:
- the HTTP session.
-
getTrailerFields
default java.util.Map<java.lang.String,java.lang.String> getTrailerFields()Get the trailer fields.- Returns:
- the trailer fields.
-
getUserPrincipal
java.security.Principal getUserPrincipal()Get 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 boolean 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
boolean isUserInRole(java.lang.String role)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(java.lang.Class<T> handlerClass) throws java.io.IOException, ServletExceptionUpgrade the request.- Type Parameters:
T
- the type of HTTP upgrade handler.- Parameters:
handlerClass
- the handler class.- Returns:
- the HTTP upgrade handler.
- Throws:
java.io.IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-