Top Description Methods
org.springframework.web.context.request.async

public Interface AsyncWebRequest

extends NativeWebRequest
Known Direct Implementers
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
Imports
java.util.function.Consumer, org.springframework.lang.Nullable, org.springframework.web.context.request.NativeWebRequest

Extends NativeWebRequest with methods for asynchronous request processing.
Author
Rossen Stoyanchev
Since
3.2

Method Summary

Modifier and TypeMethod and Description
public void
addCompletionHandler(Runnable runnable)

Add a handler to invoke when request processing completes.

public void
addErrorHandler(Consumer<Throwable> exceptionHandler)

Add a handler to invoke when an error occurred while concurrent handling of a request.

public void
addTimeoutHandler(Runnable runnable)

Add a handler to invoke when concurrent handling has timed out.

public void
dispatch()

Dispatch the request to the container in order to resume processing after concurrent execution in an application thread.

public boolean
isAsyncComplete()

Whether asynchronous processing has completed.

public boolean
isAsyncStarted()

Whether the request is in async mode following a call to startAsync().

public void
setTimeout(Long
amount of time in milliseconds; null means no timeout, i.e. rely on the default timeout of the container.
timeout
)

Set the time required for concurrent handling to complete.

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

Inherited from org.springframework.web.context.request.NativeWebRequest:
getNativeRequestgetNativeRequestgetNativeResponsegetNativeResponse

Method Detail

addCompletionHandlerback to summary
public void addCompletionHandler(Runnable runnable)

Add a handler to invoke when request processing completes.

addErrorHandlerback to summary
public void addErrorHandler(Consumer<Throwable> exceptionHandler)

Add a handler to invoke when an error occurred while concurrent handling of a request.

Since
5.0
addTimeoutHandlerback to summary
public void addTimeoutHandler(Runnable runnable)

Add a handler to invoke when concurrent handling has timed out.

dispatchback to summary
public void dispatch()

Dispatch the request to the container in order to resume processing after concurrent execution in an application thread.

isAsyncCompleteback to summary
public boolean isAsyncComplete()

Whether asynchronous processing has completed.

isAsyncStartedback to summary
public boolean isAsyncStarted()

Whether the request is in async mode following a call to startAsync(). Returns "false" if asynchronous processing never started, has completed, or the request was dispatched for further processing.

setTimeoutback to summary
public void setTimeout(Long timeout)

Set the time required for concurrent handling to complete. This property should not be set when concurrent handling is in progress, i.e. when isAsyncStarted() is true.

Parameters
timeout:Long

amount of time in milliseconds; null means no timeout, i.e. rely on the default timeout of the container.

startAsyncback to summary
public 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.

Exceptions
IllegalStateException:
if async processing has completed or is not supported