spring-framework / org.springframework.web.context.request.async / AsyncWebRequest

AsyncWebRequest

interface AsyncWebRequest : NativeWebRequest

Extends NativeWebRequest with methods for asynchronous request processing.

Author
Rossen Stoyanchev

Since
3.2

Functions

addCompletionHandler

abstract fun addCompletionHandler(runnable: Runnable): Unit

Add a handler to invoke when request processing completes.

addErrorHandler

abstract fun addErrorHandler(exceptionHandler: Consumer<Throwable>): Unit

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

addTimeoutHandler

abstract fun addTimeoutHandler(runnable: Runnable): Unit

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

dispatch

abstract fun dispatch(): Unit

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

isAsyncComplete

abstract fun isAsyncComplete(): Boolean

Whether asynchronous processing has completed.

isAsyncStarted

abstract fun isAsyncStarted(): Boolean

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.

setTimeout

abstract fun setTimeout(timeout: Long): Unit

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.

startAsync

abstract fun startAsync(): Unit

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.

Inheritors

StandardServletAsyncWebRequest

open class StandardServletAsyncWebRequest : ServletWebRequest, AsyncWebRequest, AsyncListener

A Servlet 3.0 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.