Class StandardServletAsyncWebRequest
java.lang.Object
org.springframework.web.context.request.AbstractRequestAttributes
org.springframework.web.context.request.ServletRequestAttributes
org.springframework.web.context.request.ServletWebRequest
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
- All Implemented Interfaces:
- AsyncListener, EventListener, AsyncWebRequest, NativeWebRequest, RequestAttributes, WebRequest
public class StandardServletAsyncWebRequest
extends ServletWebRequest
implements AsyncWebRequest, AsyncListener
A Servlet implementation of 
AsyncWebRequest.
The servlet and all filters involved in an async request must have async
support enabled using the Servlet API or by adding an
<async-supported>true</async-supported> element to servlet and filter
declarations in web.xml.
- Since:
- 3.2
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from class ServletRequestAttributesDESTRUCTION_CALLBACK_NAME_PREFIX, immutableValueTypesFields inherited from class AbstractRequestAttributesrequestDestructionCallbacksFields inherited from interface RequestAttributesREFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_REQUEST, SCOPE_SESSION
- 
Constructor SummaryConstructorsConstructorDescriptionStandardServletAsyncWebRequest(HttpServletRequest request, HttpServletResponse response) Create a new instance for the given request/response pair.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCompletionHandler(Runnable runnable) Add a handler to invoke when request processing completes.voidaddErrorHandler(Consumer<Throwable> exceptionHandler) Add a handler to invoke when an error occurred while concurrent handling of a request.voidaddTimeoutHandler(Runnable timeoutHandler) Add a handler to invoke when concurrent handling has timed out.voiddispatch()Dispatch the request to the container in order to resume processing after concurrent execution in an application thread.booleanWhether async request processing has completed.booleanWhether the request is in async mode following a call toAsyncWebRequest.startAsync().voidonComplete(AsyncEvent event) voidonError(AsyncEvent event) voidonStartAsync(AsyncEvent event) voidonTimeout(AsyncEvent event) voidsetTimeout(@Nullable Long timeout) In Servlet 3 async processing, the timeout period begins after the container processing thread has exited.voidMark the start of asynchronous request processing so that when the main processing thread exits, the response remains open for further processing in another thread.Methods inherited from class ServletWebRequestcheckNotModified, checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getHttpMethod, getLocale, getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isNotModified, isSecure, isUserInRole, toStringMethods inherited from class ServletRequestAttributesgetAttribute, getAttributeNames, getRequest, getResponse, getSession, getSessionId, getSessionMutex, isImmutableSessionAttribute, registerDestructionCallback, registerSessionDestructionCallback, removeAttribute, resolveReference, setAttribute, updateAccessedSessionAttributesMethods inherited from class AbstractRequestAttributesisRequestActive, registerRequestDestructionCallback, removeRequestDestructionCallback, requestCompletedMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface NativeWebRequestgetNativeRequest, getNativeRequest, getNativeResponse, getNativeResponseMethods inherited from interface RequestAttributesgetAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttributeMethods inherited from interface WebRequestcheckNotModified, checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isSecure, isUserInRole
- 
Constructor Details- 
StandardServletAsyncWebRequestCreate a new instance for the given request/response pair.- Parameters:
- request- current HTTP request
- response- current HTTP response
 
 
- 
- 
Method Details- 
setTimeoutIn Servlet 3 async processing, the timeout period begins after the container processing thread has exited.- Specified by:
- setTimeoutin interface- AsyncWebRequest
- Parameters:
- timeout- amount of time in milliseconds;- nullmeans no timeout, i.e. rely on the default timeout of the container.
 
- 
addTimeoutHandlerDescription copied from interface:AsyncWebRequestAdd a handler to invoke when concurrent handling has timed out.- Specified by:
- addTimeoutHandlerin interface- AsyncWebRequest
 
- 
addErrorHandlerDescription copied from interface:AsyncWebRequestAdd a handler to invoke when an error occurred while concurrent handling of a request.- Specified by:
- addErrorHandlerin interface- AsyncWebRequest
 
- 
addCompletionHandlerDescription copied from interface:AsyncWebRequestAdd a handler to invoke when request processing completes.- Specified by:
- addCompletionHandlerin interface- AsyncWebRequest
 
- 
isAsyncStartedpublic boolean isAsyncStarted()Description copied from interface:AsyncWebRequestWhether the request is in async mode following a call toAsyncWebRequest.startAsync(). Returns "false" if asynchronous processing never started, has completed, or the request was dispatched for further processing.- Specified by:
- isAsyncStartedin interface- AsyncWebRequest
 
- 
isAsyncCompletepublic boolean isAsyncComplete()Whether async request processing has completed.It is important to avoid use of request and response objects after async processing has completed. Servlet containers often re-use them. - Specified by:
- isAsyncCompletein interface- AsyncWebRequest
 
- 
startAsyncpublic void startAsync()Description copied from interface:AsyncWebRequestMark the start of asynchronous request processing so that when the main processing thread exits, the response remains open for further processing in another thread.- Specified by:
- startAsyncin interface- AsyncWebRequest
 
- 
dispatchpublic void dispatch()Description copied from interface:AsyncWebRequestDispatch the request to the container in order to resume processing after concurrent execution in an application thread.- Specified by:
- dispatchin interface- AsyncWebRequest
 
- 
onStartAsync- Specified by:
- onStartAsyncin interface- AsyncListener
- Throws:
- IOException
 
- 
onTimeout- Specified by:
- onTimeoutin interface- AsyncListener
- Throws:
- IOException
 
- 
onError- Specified by:
- onErrorin interface- AsyncListener
- Throws:
- IOException
 
- 
onComplete- Specified by:
- onCompletein interface- AsyncListener
- Throws:
- IOException
 
 
-