org.springframework.web.context.request.async
Class NoOpAsyncWebRequest
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.NoOpAsyncWebRequest
- All Implemented Interfaces:
- AsyncWebRequest, NativeWebRequest, RequestAttributes, WebRequest
public class NoOpAsyncWebRequest
- extends ServletWebRequest
- implements AsyncWebRequest
An implementation of AsyncWebRequest
used when no underlying support
for async request processing is available in which case startAsync()
results in an UnsupportedOperationException
.
- Since:
- 3.2
- Author:
- Rossen Stoyanchev
Constructor Summary |
NoOpAsyncWebRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
Method Summary |
void |
complete()
Complete async request processing making a best effort but without any
effect if async request processing has already completed for any reason
including a timeout. |
boolean |
isAsyncCompleted()
Whether async processing has completed either normally via calls to
AsyncWebRequest.complete() or for other reasons such as a timeout likely
detected in a separate thread during async request processing. |
boolean |
isAsyncStarted()
Whether async processing is in progress and has not yet completed. |
void |
sendError(HttpStatus status,
java.lang.String message)
Send an error to the client making a best effort to do so but without any
effect if async request processing has already completed, for example due
to a timeout. |
void |
setTimeout(java.lang.Long timeout)
Set the timeout for asynchronous request processing in milliseconds. |
void |
setTimeoutHandler(java.lang.Runnable runnable)
Invoked on a timeout to complete the response instead of the default
behavior that sets the status to 503 (SERVICE_UNAVAILABLE). |
void |
startAsync()
Mark the start of async request processing for example ensuring the
request remains open in order to be completed in a separate thread. |
Methods inherited from class org.springframework.web.context.request.ServletWebRequest |
checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getResponse, getUserPrincipal, isNotModified, isSecure, isUserInRole, toString |
Methods inherited from class org.springframework.web.context.request.ServletRequestAttributes |
getAttribute, getAttributeNames, getRequest, getSession, getSessionId, getSessionMutex, registerDestructionCallback, registerSessionDestructionCallback, removeAttribute, resolveReference, setAttribute, updateAccessedSessionAttributes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.web.context.request.WebRequest |
checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isSecure, isUserInRole |
NoOpAsyncWebRequest
public NoOpAsyncWebRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
setTimeout
public void setTimeout(java.lang.Long timeout)
- Description copied from interface:
AsyncWebRequest
- Set the timeout for asynchronous request processing in milliseconds.
In Servlet 3 async request processing, the timeout begins when the
main processing thread has exited.
- Specified by:
setTimeout
in interface AsyncWebRequest
setTimeoutHandler
public void setTimeoutHandler(java.lang.Runnable runnable)
- Description copied from interface:
AsyncWebRequest
- Invoked on a timeout to complete the response instead of the default
behavior that sets the status to 503 (SERVICE_UNAVAILABLE).
- Specified by:
setTimeoutHandler
in interface AsyncWebRequest
isAsyncStarted
public boolean isAsyncStarted()
- Description copied from interface:
AsyncWebRequest
- Whether async processing is in progress and has not yet completed.
- Specified by:
isAsyncStarted
in interface AsyncWebRequest
isAsyncCompleted
public boolean isAsyncCompleted()
- Description copied from interface:
AsyncWebRequest
- Whether async processing has completed either normally via calls to
AsyncWebRequest.complete()
or for other reasons such as a timeout likely
detected in a separate thread during async request processing.
- Specified by:
isAsyncCompleted
in interface AsyncWebRequest
startAsync
public void startAsync()
- Description copied from interface:
AsyncWebRequest
- Mark the start of async request processing for example ensuring the
request remains open in order to be completed in a separate thread.
- Specified by:
startAsync
in interface AsyncWebRequest
complete
public void complete()
- Description copied from interface:
AsyncWebRequest
- Complete async request processing making a best effort but without any
effect if async request processing has already completed for any reason
including a timeout.
- Specified by:
complete
in interface AsyncWebRequest
sendError
public void sendError(HttpStatus status,
java.lang.String message)
- Description copied from interface:
AsyncWebRequest
- Send an error to the client making a best effort to do so but without any
effect if async request processing has already completed, for example due
to a timeout.
- Specified by:
sendError
in interface AsyncWebRequest