Package org.atmosphere.cpr
Class AtmosphereRequestImpl
java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.atmosphere.cpr.AtmosphereRequestImpl
- All Implemented Interfaces:
HttpServletRequest,ServletRequest,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.
-
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(HttpServletResponse response) body()Return the request's body.body(byte[] bytes) body(InputStream body) static AtmosphereRequestcloneRequest(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.intCookie[]longgetDateHeader(String name) getHeaders(String name) intgetIntHeader(String name) intString[]getParts()getRealPath(String path) intgetRequestDispatcher(String path) intgetSession(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(ServletRequest request) startAsync(ServletRequest request, ServletResponse response) toString()uuid()Return the underlyingAtmosphereResource.uuid().static AtmosphereRequestwrap(HttpServletRequest request) Wrap anHttpServletRequest.Methods 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 interfaceHttpServletRequest- Overrides:
getPathInfoin classHttpServletRequestWrapper
-
getPathTranslated
- Specified by:
getPathTranslatedin interfaceHttpServletRequest- Overrides:
getPathTranslatedin classHttpServletRequestWrapper
-
getQueryString
- Specified by:
getQueryStringin interfaceHttpServletRequest- Overrides:
getQueryStringin classHttpServletRequestWrapper
-
getRemoteUser
- Specified by:
getRemoteUserin interfaceHttpServletRequest- Overrides:
getRemoteUserin classHttpServletRequestWrapper
-
getRequestedSessionId
- Specified by:
getRequestedSessionIdin interfaceHttpServletRequest- Overrides:
getRequestedSessionIdin classHttpServletRequestWrapper
-
getMethod
- Specified by:
getMethodin interfaceHttpServletRequest- Overrides:
getMethodin classHttpServletRequestWrapper
-
getPart
- Specified by:
getPartin interfaceHttpServletRequest- Overrides:
getPartin classHttpServletRequestWrapper- Throws:
IOExceptionServletException
-
getParts
- Specified by:
getPartsin interfaceHttpServletRequest- Overrides:
getPartsin classHttpServletRequestWrapper- Throws:
IOExceptionServletException
-
getContentType
- Specified by:
getContentTypein interfaceServletRequest- Overrides:
getContentTypein classServletRequestWrapper
-
getDispatcherType
- Specified by:
getDispatcherTypein interfaceServletRequest- Overrides:
getDispatcherTypein classServletRequestWrapper
-
getServletPath
- Specified by:
getServletPathin interfaceHttpServletRequest- Overrides:
getServletPathin classHttpServletRequestWrapper
-
getRequestURI
- Specified by:
getRequestURIin interfaceHttpServletRequest- Overrides:
getRequestURIin classHttpServletRequestWrapper
-
getRequestURL
- Specified by:
getRequestURLin interfaceHttpServletRequest- Overrides:
getRequestURLin classHttpServletRequestWrapper
-
getHeaders
- Specified by:
getHeadersin interfaceHttpServletRequest- Overrides:
getHeadersin classHttpServletRequestWrapper
-
getIntHeader
- Specified by:
getIntHeaderin interfaceHttpServletRequest- Overrides:
getIntHeaderin classHttpServletRequestWrapper
-
getHeaderNames
- Specified by:
getHeaderNamesin interfaceHttpServletRequest- Overrides:
getHeaderNamesin classHttpServletRequestWrapper
-
authenticate
- Specified by:
authenticatein interfaceHttpServletRequest- Overrides:
authenticatein classHttpServletRequestWrapper- Throws:
IOExceptionServletException
-
getAuthType
- Specified by:
getAuthTypein interfaceHttpServletRequest- Overrides:
getAuthTypein classHttpServletRequestWrapper
-
getContextPath
- Specified by:
getContextPathin interfaceHttpServletRequest- Overrides:
getContextPathin classHttpServletRequestWrapper
-
getCookies
- Specified by:
getCookiesin interfaceHttpServletRequest- Overrides:
getCookiesin classHttpServletRequestWrapper
-
getDateHeader
- Specified by:
getDateHeaderin interfaceHttpServletRequest- Overrides:
getDateHeaderin classHttpServletRequestWrapper
-
getHeader
- Specified by:
getHeaderin interfaceHttpServletRequest- Overrides:
getHeaderin classHttpServletRequestWrapper
-
wrappedRequest
- Specified by:
wrappedRequestin interfaceAtmosphereRequest
-
getHeader
- Specified by:
getHeaderin interfaceAtmosphereRequest
-
getParameter
- Specified by:
getParameterin interfaceServletRequest- Overrides:
getParameterin classServletRequestWrapper
-
getParameterMap
- Specified by:
getParameterMapin interfaceServletRequest- Overrides:
getParameterMapin classServletRequestWrapper
-
getParameterNames
- Specified by:
getParameterNamesin interfaceServletRequest- Overrides:
getParameterNamesin classServletRequestWrapper
-
getParameterValues
- Specified by:
getParameterValuesin interfaceServletRequest- Overrides:
getParameterValuesin classServletRequestWrapper
-
getProtocol
- Specified by:
getProtocolin interfaceServletRequest- Overrides:
getProtocolin classServletRequestWrapper
-
getInputStream
- Specified by:
getInputStreamin interfaceServletRequest- Overrides:
getInputStreamin classServletRequestWrapper- Throws:
IOException
-
getReader
- Specified by:
getReaderin interfaceServletRequest- Overrides:
getReaderin classServletRequestWrapper- Throws:
IOException
-
getRealPath
- Specified by:
getRealPathin interfaceServletRequest- Overrides:
getRealPathin classServletRequestWrapper
-
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 interfaceServletRequest- Overrides:
setAttributein classServletRequestWrapper
-
setCharacterEncoding
- Specified by:
setCharacterEncodingin interfaceServletRequest- Overrides:
setCharacterEncodingin classServletRequestWrapper- Throws:
UnsupportedEncodingException
-
startAsync
- Specified by:
startAsyncin interfaceServletRequest- Overrides:
startAsyncin classServletRequestWrapper
-
startAsync
- Specified by:
startAsyncin interfaceServletRequest- Overrides:
startAsyncin classServletRequestWrapper
-
getAsyncContext
- Specified by:
getAsyncContextin interfaceServletRequest- Overrides:
getAsyncContextin classServletRequestWrapper
-
getAttribute
- Specified by:
getAttributein interfaceServletRequest- Overrides:
getAttributein classServletRequestWrapper
-
removeAttribute
- Specified by:
removeAttributein interfaceServletRequest- Overrides:
removeAttributein classServletRequestWrapper
-
getSession
- Specified by:
getSessionin interfaceHttpServletRequest- Overrides:
getSessionin classHttpServletRequestWrapper
-
getSession
- Specified by:
getSessionin interfaceHttpServletRequest- Overrides:
getSessionin classHttpServletRequestWrapper
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfaceHttpServletRequest- Overrides:
getUserPrincipalin classHttpServletRequestWrapper
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()- Specified by:
isRequestedSessionIdFromCookiein interfaceHttpServletRequest- Overrides:
isRequestedSessionIdFromCookiein classHttpServletRequestWrapper
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()- Specified by:
isRequestedSessionIdFromUrlin interfaceHttpServletRequest- Overrides:
isRequestedSessionIdFromUrlin classHttpServletRequestWrapper
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()- Specified by:
isRequestedSessionIdFromURLin interfaceHttpServletRequest- Overrides:
isRequestedSessionIdFromURLin classHttpServletRequestWrapper
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()- Specified by:
isRequestedSessionIdValidin interfaceHttpServletRequest- Overrides:
isRequestedSessionIdValidin classHttpServletRequestWrapper
-
isUserInRole
- Specified by:
isUserInRolein interfaceHttpServletRequest- Overrides:
isUserInRolein classHttpServletRequestWrapper
-
login
- Specified by:
loginin interfaceHttpServletRequest- Overrides:
loginin classHttpServletRequestWrapper- Throws:
ServletException
-
logout
- Specified by:
logoutin interfaceHttpServletRequest- Overrides:
logoutin classHttpServletRequestWrapper- Throws:
ServletException
-
getRemoteAddr
- Specified by:
getRemoteAddrin interfaceServletRequest- Overrides:
getRemoteAddrin classServletRequestWrapper
-
getRemoteHost
- Specified by:
getRemoteHostin interfaceServletRequest- Overrides:
getRemoteHostin classServletRequestWrapper
-
getRemotePort
public int getRemotePort()- Specified by:
getRemotePortin interfaceServletRequest- Overrides:
getRemotePortin classServletRequestWrapper
-
getRequestDispatcher
- Specified by:
getRequestDispatcherin interfaceServletRequest- Overrides:
getRequestDispatcherin classServletRequestWrapper
-
getScheme
- Specified by:
getSchemein interfaceServletRequest- Overrides:
getSchemein classServletRequestWrapper
-
getServerName
- Specified by:
getServerNamein interfaceServletRequest- Overrides:
getServerNamein classServletRequestWrapper
-
getServerPort
public int getServerPort()- Specified by:
getServerPortin interfaceServletRequest- Overrides:
getServerPortin classServletRequestWrapper
-
getServletContext
- Specified by:
getServletContextin interfaceServletRequest- Overrides:
getServletContextin classServletRequestWrapper
-
isAsyncStarted
public boolean isAsyncStarted()- Specified by:
isAsyncStartedin interfaceServletRequest- Overrides:
isAsyncStartedin classServletRequestWrapper
-
isAsyncSupported
public boolean isAsyncSupported()- Specified by:
isAsyncSupportedin interfaceServletRequest- Overrides:
isAsyncSupportedin classServletRequestWrapper
-
isSecure
public boolean isSecure()- Specified by:
isSecurein interfaceServletRequest- Overrides:
isSecurein classServletRequestWrapper
-
getLocalName
- Specified by:
getLocalNamein interfaceServletRequest- Overrides:
getLocalNamein classServletRequestWrapper
-
getLocalPort
public int getLocalPort()- Specified by:
getLocalPortin interfaceServletRequest- Overrides:
getLocalPortin classServletRequestWrapper
-
getLocalAddr
- Specified by:
getLocalAddrin interfaceServletRequest- Overrides:
getLocalAddrin classServletRequestWrapper
-
getLocale
- Specified by:
getLocalein interfaceServletRequest- Overrides:
getLocalein classServletRequestWrapper
-
resource
Description copied from interface:AtmosphereRequestTheAtmosphereResourceassociated with this request.- Specified by:
resourcein interfaceAtmosphereRequest- Returns:
- an
AtmosphereResource
-
getLocales
- Specified by:
getLocalesin interfaceServletRequest- Overrides:
getLocalesin classServletRequestWrapper
-
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 interfaceServletRequest- Overrides:
getAttributeNamesin classServletRequestWrapper
-
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 interfaceServletRequest- Overrides:
getCharacterEncodingin classServletRequestWrapper
-
getContentLength
public int getContentLength()- Specified by:
getContentLengthin interfaceServletRequest- Overrides:
getContentLengthin classServletRequestWrapper
-
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
- Overrides:
setRequestin classServletRequestWrapper
-
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(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.