Spring Framework

org.springframework.web.context.request.async
Interface AsyncWebRequest

All Superinterfaces:
NativeWebRequest, RequestAttributes, WebRequest
All Known Implementing Classes:
NoOpAsyncWebRequest, StandardServletAsyncWebRequest

public interface AsyncWebRequest
extends NativeWebRequest

Extend NativeWebRequest with methods for async request processing.

Since:
3.2
Author:
Rossen Stoyanchev

Field Summary
 
Fields inherited from interface org.springframework.web.context.request.RequestAttributes
REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION
 
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 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 interface org.springframework.web.context.request.NativeWebRequest
getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse
 
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
 
Methods inherited from interface org.springframework.web.context.request.RequestAttributes
getAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttribute
 

Method Detail

setTimeout

void setTimeout(java.lang.Long timeout)
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.


setTimeoutHandler

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).


startAsync

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.

Throws:
java.lang.IllegalStateException - if async processing has started, if it is not supported, or if it has completed.

isAsyncStarted

boolean isAsyncStarted()
Whether async processing is in progress and has not yet completed.


complete

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.


isAsyncCompleted

boolean isAsyncCompleted()
Whether async processing has completed either normally via calls to complete() or for other reasons such as a timeout likely detected in a separate thread during async request processing.


sendError

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.


Spring Framework