public class StandardServletAsyncWebRequest extends ServletWebRequest implements AsyncWebRequest, javax.servlet.AsyncListener
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-support>true</async-support> element to servlet and filter
declarations in web.xml
DESTRUCTION_CALLBACK_NAME_PREFIXrequestDestructionCallbacksREFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION| Constructor and Description |
|---|
StandardServletAsyncWebRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Create a new instance for the given request/response pair.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCompletionHandler(java.lang.Runnable runnable)
Add a Runnable to be invoked when request processing completes.
|
void |
dispatch()
Dispatch the request to the container in order to resume processing after
concurrent execution in an application thread.
|
boolean |
isAsyncComplete()
Whether async request processing has completed.
|
boolean |
isAsyncStarted()
Whether the request is in async mode following a call to
AsyncWebRequest.startAsync(). |
boolean |
isDispatched()
Whether the request was dispatched to the container in order to resume
processing after concurrent execution in an application thread.
|
void |
onComplete(javax.servlet.AsyncEvent event) |
void |
onError(javax.servlet.AsyncEvent event) |
void |
onStartAsync(javax.servlet.AsyncEvent event) |
void |
onTimeout(javax.servlet.AsyncEvent event) |
void |
setTimeout(java.lang.Long timeout)
Set the time required for concurrent handling to complete.
|
void |
setTimeoutHandler(java.lang.Runnable timeoutHandler)
Set the handler to use when concurrent handling has timed out.
|
void |
startAsync()
Mark the start of asynchronous request processing so that when the main
processing thread exits, the response remains open for further processing
in another thread.
|
checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getResponse, getUserPrincipal, isNotModified, isSecure, isUserInRole, toStringgetAttribute, getAttributeNames, getRequest, getSession, getSessionId, getSessionMutex, registerDestructionCallback, registerSessionDestructionCallback, removeAttribute, resolveReference, setAttribute, updateAccessedSessionAttributesisRequestActive, registerRequestDestructionCallback, removeRequestDestructionCallback, requestCompletedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetNativeRequest, getNativeRequest, getNativeResponse, getNativeResponsecheckNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isSecure, isUserInRolegetAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttributepublic StandardServletAsyncWebRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
request - current HTTP requestresponse - current HTTP responsepublic void setTimeout(java.lang.Long timeout)
AsyncWebRequest.isAsyncStarted() is true.
In Servlet 3 async processing, the timeout period begins after the container processing thread has exited.
setTimeout in interface AsyncWebRequesttimeout - amount of time in milliseconds; null means no
timeout, i.e. rely on the default timeout of the container.public void setTimeoutHandler(java.lang.Runnable timeoutHandler)
If not set, by default a timeout is handled by returning SERVICE_UNAVAILABLE (503).
setTimeoutHandler in interface AsyncWebRequestpublic void addCompletionHandler(java.lang.Runnable runnable)
AsyncWebRequestaddCompletionHandler in interface AsyncWebRequestpublic boolean isAsyncStarted()
AsyncWebRequestAsyncWebRequest.startAsync().
Returns "false" if asynchronous processing never started, has completed,
or the request was dispatched for further processing.isAsyncStarted in interface AsyncWebRequestpublic boolean isDispatched()
AsyncWebRequestisDispatched in interface AsyncWebRequestpublic boolean isAsyncComplete()
It is important to avoid use of request and response objects after async processing has completed. Servlet containers often re-use them.
isAsyncComplete in interface AsyncWebRequestpublic void startAsync()
AsyncWebRequeststartAsync in interface AsyncWebRequestpublic void dispatch()
AsyncWebRequestdispatch in interface AsyncWebRequestpublic void onStartAsync(javax.servlet.AsyncEvent event)
throws java.io.IOException
onStartAsync in interface javax.servlet.AsyncListenerjava.io.IOExceptionpublic void onError(javax.servlet.AsyncEvent event)
throws java.io.IOException
onError in interface javax.servlet.AsyncListenerjava.io.IOExceptionpublic void onTimeout(javax.servlet.AsyncEvent event)
throws java.io.IOException
onTimeout in interface javax.servlet.AsyncListenerjava.io.IOExceptionpublic void onComplete(javax.servlet.AsyncEvent event)
throws java.io.IOException
onComplete in interface javax.servlet.AsyncListenerjava.io.IOException