java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.atmosphere.cpr.AtmosphereRequestImpl
- All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest,jakarta.servlet.ServletRequest,AtmosphereRequest
public class AtmosphereRequestImpl
extends jakarta.servlet.http.HttpServletRequestWrapper
implements AtmosphereRequest
An Atmosphere request representation. An
AtmosphereRequest is a two-way communication channel between the
client and the server. If the isDestroyable() is set to false, or if its
associated AtmosphereResource has been suspended, this object can be re-used at any moment between requests.
You can use its associated AtmosphereResponse to write bytes at any moment, making this object bi-directional.
- Author:
- Jeanfrancois Arcand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final classstatic final classstatic classDeprecated.Nested classes/interfaces inherited from interface org.atmosphere.cpr.AtmosphereRequest
AtmosphereRequest.LocalAttributes -
Field Summary
Fields inherited from interface jakarta.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(jakarta.servlet.http.HttpServletResponse response) body()Return the request's body.body(byte[] bytes) body(InputStream body) static AtmosphereRequestcloneRequest(jakarta.servlet.http.HttpServletRequest request, boolean loadInMemory, boolean copySession, boolean isDestroyable, boolean createSession) Copy the HttpServletRequest content inside an AtmosphereRequest.contextPath(String contextPath) voiddestroy()voiddestroy(boolean force) destroyable(boolean destroyable) booleanbooleanDispatch the request asynchronously to container.jakarta.servlet.AsyncContextintjakarta.servlet.http.Cookie[]longgetDateHeader(String name) jakarta.servlet.DispatcherTypegetHeaders(String name) jakarta.servlet.ServletInputStreamintgetIntHeader(String name) intString[]jakarta.servlet.http.PartCollection<jakarta.servlet.http.Part> getParts()getRealPath(String path) intjakarta.servlet.RequestDispatchergetRequestDispatcher(String path) intjakarta.servlet.ServletContextjakarta.servlet.http.HttpSessionjakarta.servlet.http.HttpSessiongetSession(boolean create) Add a header.Add all headers contained within the Map.booleanbooleanbooleanCheck if this object can be destroyed.booleanbooleanbooleanbooleanbooleanisSecure()booleanisUserInRole(String role) Return a subset of the attributes set on this AtmosphereRequest, set locally by the framework or by an application.voidvoidlogout()static AtmosphereRequestCreate an instance of this class without an associatedHttpServletRequest.queryString(String qs) Set the query string.voidremoveAttribute(String name) requestURI(String requestURI) resource()TheAtmosphereResourceassociated with this request.servletPath(String servletPath) voidsetAttribute(String s, Object o) voidvoidsetRequest(jakarta.servlet.ServletRequest request) jakarta.servlet.AsyncContextjakarta.servlet.AsyncContextstartAsync(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) toString()uuid()Return the underlyingAtmosphereResource.uuid().static AtmosphereRequestwrap(jakarta.servlet.http.HttpServletRequest request) Wrap anHttpServletRequest.jakarta.servlet.http.HttpServletRequestMethods inherited from class jakarta.servlet.http.HttpServletRequestWrapper
changeSessionId, getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder, upgradeMethods inherited from class jakarta.servlet.ServletRequestWrapper
getContentLengthLong, getRequest, isWrapperFor, isWrapperForMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jakarta.servlet.http.HttpServletRequest
changeSessionId, getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder, upgradeMethods inherited from interface jakarta.servlet.ServletRequest
getContentLengthLong
-
Method Details
-
destroyed
public boolean destroyed()- Specified by:
destroyedin interfaceAtmosphereRequest
-
destroyable
- Specified by:
destroyablein interfaceAtmosphereRequest
-
getPathInfo
- Specified by:
getPathInfoin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getPathInfoin classjakarta.servlet.http.HttpServletRequestWrapper
-
getPathTranslated
- Specified by:
getPathTranslatedin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getPathTranslatedin classjakarta.servlet.http.HttpServletRequestWrapper
-
getQueryString
- Specified by:
getQueryStringin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getQueryStringin classjakarta.servlet.http.HttpServletRequestWrapper
-
getRemoteUser
- Specified by:
getRemoteUserin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getRemoteUserin classjakarta.servlet.http.HttpServletRequestWrapper
-
getRequestedSessionId
- Specified by:
getRequestedSessionIdin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getRequestedSessionIdin classjakarta.servlet.http.HttpServletRequestWrapper
-
getMethod
- Specified by:
getMethodin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getMethodin classjakarta.servlet.http.HttpServletRequestWrapper
-
getPart
public jakarta.servlet.http.Part getPart(String name) throws IOException, jakarta.servlet.ServletException - Specified by:
getPartin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getPartin classjakarta.servlet.http.HttpServletRequestWrapper- Throws:
IOExceptionjakarta.servlet.ServletException
-
getParts
public Collection<jakarta.servlet.http.Part> getParts() throws IOException, jakarta.servlet.ServletException- Specified by:
getPartsin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getPartsin classjakarta.servlet.http.HttpServletRequestWrapper- Throws:
IOExceptionjakarta.servlet.ServletException
-
getContentType
- Specified by:
getContentTypein interfacejakarta.servlet.ServletRequest- Overrides:
getContentTypein classjakarta.servlet.ServletRequestWrapper
-
getDispatcherType
public jakarta.servlet.DispatcherType getDispatcherType()- Specified by:
getDispatcherTypein interfacejakarta.servlet.ServletRequest- Overrides:
getDispatcherTypein classjakarta.servlet.ServletRequestWrapper
-
getServletPath
- Specified by:
getServletPathin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getServletPathin classjakarta.servlet.http.HttpServletRequestWrapper
-
getRequestURI
- Specified by:
getRequestURIin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getRequestURIin classjakarta.servlet.http.HttpServletRequestWrapper
-
getRequestURL
- Specified by:
getRequestURLin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getRequestURLin classjakarta.servlet.http.HttpServletRequestWrapper
-
getHeaders
- Specified by:
getHeadersin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getHeadersin classjakarta.servlet.http.HttpServletRequestWrapper
-
getIntHeader
- Specified by:
getIntHeaderin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getIntHeaderin classjakarta.servlet.http.HttpServletRequestWrapper
-
getHeaderNames
- Specified by:
getHeaderNamesin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getHeaderNamesin classjakarta.servlet.http.HttpServletRequestWrapper
-
authenticate
public boolean authenticate(jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException - Specified by:
authenticatein interfacejakarta.servlet.http.HttpServletRequest- Overrides:
authenticatein classjakarta.servlet.http.HttpServletRequestWrapper- Throws:
IOExceptionjakarta.servlet.ServletException
-
getAuthType
- Specified by:
getAuthTypein interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getAuthTypein classjakarta.servlet.http.HttpServletRequestWrapper
-
getContextPath
- Specified by:
getContextPathin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getContextPathin classjakarta.servlet.http.HttpServletRequestWrapper
-
getCookies
public jakarta.servlet.http.Cookie[] getCookies()- Specified by:
getCookiesin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getCookiesin classjakarta.servlet.http.HttpServletRequestWrapper
-
getDateHeader
- Specified by:
getDateHeaderin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getDateHeaderin classjakarta.servlet.http.HttpServletRequestWrapper
-
getHeader
- Specified by:
getHeaderin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getHeaderin classjakarta.servlet.http.HttpServletRequestWrapper
-
wrappedRequest
public jakarta.servlet.http.HttpServletRequest wrappedRequest()- Specified by:
wrappedRequestin interfaceAtmosphereRequest
-
getHeader
- Specified by:
getHeaderin interfaceAtmosphereRequest
-
getParameter
- Specified by:
getParameterin interfacejakarta.servlet.ServletRequest- Overrides:
getParameterin classjakarta.servlet.ServletRequestWrapper
-
getParameterMap
- Specified by:
getParameterMapin interfacejakarta.servlet.ServletRequest- Overrides:
getParameterMapin classjakarta.servlet.ServletRequestWrapper
-
getParameterNames
- Specified by:
getParameterNamesin interfacejakarta.servlet.ServletRequest- Overrides:
getParameterNamesin classjakarta.servlet.ServletRequestWrapper
-
getParameterValues
- Specified by:
getParameterValuesin interfacejakarta.servlet.ServletRequest- Overrides:
getParameterValuesin classjakarta.servlet.ServletRequestWrapper
-
getProtocol
- Specified by:
getProtocolin interfacejakarta.servlet.ServletRequest- Overrides:
getProtocolin classjakarta.servlet.ServletRequestWrapper
-
getInputStream
- Specified by:
getInputStreamin interfacejakarta.servlet.ServletRequest- Overrides:
getInputStreamin classjakarta.servlet.ServletRequestWrapper- Throws:
IOException
-
getReader
- Specified by:
getReaderin interfacejakarta.servlet.ServletRequest- Overrides:
getReaderin classjakarta.servlet.ServletRequestWrapper- Throws:
IOException
-
getRealPath
- Specified by:
getRealPathin interfacejakarta.servlet.ServletRequest- Overrides:
getRealPathin classjakarta.servlet.ServletRequestWrapper
-
headers
Description copied from interface:AtmosphereRequestAdd all headers contained within the Map.- Specified by:
headersin interfaceAtmosphereRequest- Parameters:
headers-- Returns:
- this;
-
header
Description copied from interface:AtmosphereRequestAdd a header.- Specified by:
headerin interfaceAtmosphereRequest- Parameters:
name-value-- Returns:
- this
-
queryString
Description copied from interface:AtmosphereRequestSet the query string.- Specified by:
queryStringin interfaceAtmosphereRequest- Parameters:
qs-- Returns:
- this
-
headersMap
- Specified by:
headersMapin interfaceAtmosphereRequest
-
queryStringsMap
- Specified by:
queryStringsMapin interfaceAtmosphereRequest
-
method
- Specified by:
methodin interfaceAtmosphereRequest
-
contentType
- Specified by:
contentTypein interfaceAtmosphereRequest
-
body
- Specified by:
bodyin interfaceAtmosphereRequest
-
body
- Specified by:
bodyin interfaceAtmosphereRequest
-
body
- Specified by:
bodyin interfaceAtmosphereRequest
-
body
- Specified by:
bodyin interfaceAtmosphereRequest
-
body
Description copied from interface:AtmosphereRequestReturn the request's body. This method will return an empty Body if the underlying container or framework is using InputStream or Reader.- Specified by:
bodyin interfaceAtmosphereRequest- Returns:
- the request body;
-
servletPath
- Specified by:
servletPathin interfaceAtmosphereRequest
-
contextPath
- Specified by:
contextPathin interfaceAtmosphereRequest
-
requestURI
- Specified by:
requestURIin interfaceAtmosphereRequest
-
setAttribute
- Specified by:
setAttributein interfacejakarta.servlet.ServletRequest- Overrides:
setAttributein classjakarta.servlet.ServletRequestWrapper
-
setCharacterEncoding
- Specified by:
setCharacterEncodingin interfacejakarta.servlet.ServletRequest- Overrides:
setCharacterEncodingin classjakarta.servlet.ServletRequestWrapper- Throws:
UnsupportedEncodingException
-
startAsync
public jakarta.servlet.AsyncContext startAsync()- Specified by:
startAsyncin interfacejakarta.servlet.ServletRequest- Overrides:
startAsyncin classjakarta.servlet.ServletRequestWrapper
-
startAsync
public jakarta.servlet.AsyncContext startAsync(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) - Specified by:
startAsyncin interfacejakarta.servlet.ServletRequest- Overrides:
startAsyncin classjakarta.servlet.ServletRequestWrapper
-
getAsyncContext
public jakarta.servlet.AsyncContext getAsyncContext()- Specified by:
getAsyncContextin interfacejakarta.servlet.ServletRequest- Overrides:
getAsyncContextin classjakarta.servlet.ServletRequestWrapper
-
getAttribute
- Specified by:
getAttributein interfacejakarta.servlet.ServletRequest- Overrides:
getAttributein classjakarta.servlet.ServletRequestWrapper
-
removeAttribute
- Specified by:
removeAttributein interfacejakarta.servlet.ServletRequest- Overrides:
removeAttributein classjakarta.servlet.ServletRequestWrapper
-
getSession
public jakarta.servlet.http.HttpSession getSession()- Specified by:
getSessionin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getSessionin classjakarta.servlet.http.HttpServletRequestWrapper
-
getSession
public jakarta.servlet.http.HttpSession getSession(boolean create) - Specified by:
getSessionin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getSessionin classjakarta.servlet.http.HttpServletRequestWrapper
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
getUserPrincipalin classjakarta.servlet.http.HttpServletRequestWrapper
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()- Specified by:
isRequestedSessionIdFromCookiein interfacejakarta.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdFromCookiein classjakarta.servlet.http.HttpServletRequestWrapper
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()- Specified by:
isRequestedSessionIdFromUrlin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdFromUrlin classjakarta.servlet.http.HttpServletRequestWrapper
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()- Specified by:
isRequestedSessionIdFromURLin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdFromURLin classjakarta.servlet.http.HttpServletRequestWrapper
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()- Specified by:
isRequestedSessionIdValidin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdValidin classjakarta.servlet.http.HttpServletRequestWrapper
-
isUserInRole
- Specified by:
isUserInRolein interfacejakarta.servlet.http.HttpServletRequest- Overrides:
isUserInRolein classjakarta.servlet.http.HttpServletRequestWrapper
-
login
- Specified by:
loginin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
loginin classjakarta.servlet.http.HttpServletRequestWrapper- Throws:
jakarta.servlet.ServletException
-
logout
public void logout() throws jakarta.servlet.ServletException- Specified by:
logoutin interfacejakarta.servlet.http.HttpServletRequest- Overrides:
logoutin classjakarta.servlet.http.HttpServletRequestWrapper- Throws:
jakarta.servlet.ServletException
-
getRemoteAddr
- Specified by:
getRemoteAddrin interfacejakarta.servlet.ServletRequest- Overrides:
getRemoteAddrin classjakarta.servlet.ServletRequestWrapper
-
getRemoteHost
- Specified by:
getRemoteHostin interfacejakarta.servlet.ServletRequest- Overrides:
getRemoteHostin classjakarta.servlet.ServletRequestWrapper
-
getRemotePort
public int getRemotePort()- Specified by:
getRemotePortin interfacejakarta.servlet.ServletRequest- Overrides:
getRemotePortin classjakarta.servlet.ServletRequestWrapper
-
getRequestDispatcher
- Specified by:
getRequestDispatcherin interfacejakarta.servlet.ServletRequest- Overrides:
getRequestDispatcherin classjakarta.servlet.ServletRequestWrapper
-
getScheme
- Specified by:
getSchemein interfacejakarta.servlet.ServletRequest- Overrides:
getSchemein classjakarta.servlet.ServletRequestWrapper
-
getServerName
- Specified by:
getServerNamein interfacejakarta.servlet.ServletRequest- Overrides:
getServerNamein classjakarta.servlet.ServletRequestWrapper
-
getServerPort
public int getServerPort()- Specified by:
getServerPortin interfacejakarta.servlet.ServletRequest- Overrides:
getServerPortin classjakarta.servlet.ServletRequestWrapper
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()- Specified by:
getServletContextin interfacejakarta.servlet.ServletRequest- Overrides:
getServletContextin classjakarta.servlet.ServletRequestWrapper
-
isAsyncStarted
public boolean isAsyncStarted()- Specified by:
isAsyncStartedin interfacejakarta.servlet.ServletRequest- Overrides:
isAsyncStartedin classjakarta.servlet.ServletRequestWrapper
-
isAsyncSupported
public boolean isAsyncSupported()- Specified by:
isAsyncSupportedin interfacejakarta.servlet.ServletRequest- Overrides:
isAsyncSupportedin classjakarta.servlet.ServletRequestWrapper
-
isSecure
public boolean isSecure()- Specified by:
isSecurein interfacejakarta.servlet.ServletRequest- Overrides:
isSecurein classjakarta.servlet.ServletRequestWrapper
-
getLocalName
- Specified by:
getLocalNamein interfacejakarta.servlet.ServletRequest- Overrides:
getLocalNamein classjakarta.servlet.ServletRequestWrapper
-
getLocalPort
public int getLocalPort()- Specified by:
getLocalPortin interfacejakarta.servlet.ServletRequest- Overrides:
getLocalPortin classjakarta.servlet.ServletRequestWrapper
-
getLocalAddr
- Specified by:
getLocalAddrin interfacejakarta.servlet.ServletRequest- Overrides:
getLocalAddrin classjakarta.servlet.ServletRequestWrapper
-
getLocale
- Specified by:
getLocalein interfacejakarta.servlet.ServletRequest- Overrides:
getLocalein classjakarta.servlet.ServletRequestWrapper
-
resource
Description copied from interface:AtmosphereRequestTheAtmosphereResourceassociated with this request.- Specified by:
resourcein interfaceAtmosphereRequest- Returns:
- an
AtmosphereResource
-
getLocales
- Specified by:
getLocalesin interfacejakarta.servlet.ServletRequest- Overrides:
getLocalesin classjakarta.servlet.ServletRequestWrapper
-
dispatchRequestAsynchronously
public boolean dispatchRequestAsynchronously()Description copied from interface:AtmosphereRequestDispatch the request asynchronously to container. The default is false.- Specified by:
dispatchRequestAsynchronouslyin interfaceAtmosphereRequest- Returns:
- true to dispatch the request asynchronously to container.
-
isDestroyable
public boolean isDestroyable()Description copied from interface:AtmosphereRequestCheck if this object can be destroyed. Default is true.- Specified by:
isDestroyablein interfaceAtmosphereRequest
-
pathInfo
- Specified by:
pathInfoin interfaceAtmosphereRequest
-
getAttributeNames
- Specified by:
getAttributeNamesin interfacejakarta.servlet.ServletRequest- Overrides:
getAttributeNamesin classjakarta.servlet.ServletRequestWrapper
-
localAttributes
Description copied from interface:AtmosphereRequestReturn a subset of the attributes set on this AtmosphereRequest, set locally by the framework or by an application. Attributes added using this method won't be propagated to the original, container-only, native request object.- Specified by:
localAttributesin interfaceAtmosphereRequest- Returns:
- a
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfacejakarta.servlet.ServletRequest- Overrides:
getCharacterEncodingin classjakarta.servlet.ServletRequestWrapper
-
getContentLength
public int getContentLength()- Specified by:
getContentLengthin interfacejakarta.servlet.ServletRequest- Overrides:
getContentLengthin classjakarta.servlet.ServletRequestWrapper
-
uuid
Description copied from interface:AtmosphereRequestReturn the underlyingAtmosphereResource.uuid(). May return "0" if noAtmosphereResourceis associated with this object.- Specified by:
uuidin interfaceAtmosphereRequest- Returns:
- the underlying
AtmosphereResource.uuid()
-
destroy
public void destroy()- Specified by:
destroyin interfaceAtmosphereRequest
-
destroy
public void destroy(boolean force) - Specified by:
destroyin interfaceAtmosphereRequest
-
setRequest
public void setRequest(jakarta.servlet.ServletRequest request) - Overrides:
setRequestin classjakarta.servlet.ServletRequestWrapper
-
newInstance
Create an instance of this class without an associatedHttpServletRequest.- Returns:
- an instance of this class without an associated
HttpServletRequest
-
wrap
Wrap anHttpServletRequest.- Parameters:
request-HttpServletRequest- Returns:
- an
AtmosphereRequest
-
cloneRequest
public static AtmosphereRequest cloneRequest(jakarta.servlet.http.HttpServletRequest request, boolean loadInMemory, boolean copySession, boolean isDestroyable, boolean createSession) Copy the HttpServletRequest content inside an AtmosphereRequest. By default the returned AtmosphereRequest is not destroyable.- Parameters:
request-HttpServletRequest- Returns:
- an
AtmosphereRequest
-
toString
-
requestURL
- Specified by:
requestURLin interfaceAtmosphereRequest
-
NoOpsRequestdirectly instead.