接口 AsyncWebRequest
- 所有超级接口:
NativeWebRequest
,RequestAttributes
,WebRequest
- 所有已知实现类:
StandardServletAsyncWebRequest
public interface AsyncWebRequest extends NativeWebRequest
ExtendsNativeWebRequest
with methods for asynchronous request processing.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
字段概要
从接口继承的字段 org.springframework.web.context.request.RequestAttributes
REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_REQUEST, SCOPE_SESSION
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 void
addCompletionHandler(Runnable runnable)
Add a handler to invoke when request processing completes.void
addErrorHandler(Consumer<Throwable> exceptionHandler)
Add a handler to invoke when an error occurred while concurrent handling of a request.void
addTimeoutHandler(Runnable runnable)
Add a handler to invoke when concurrent handling has timed out.void
dispatch()
Dispatch the request to the container in order to resume processing after concurrent execution in an application thread.boolean
isAsyncComplete()
Whether asynchronous processing has completed.boolean
isAsyncStarted()
Whether the request is in async mode following a call tostartAsync()
.void
setTimeout(Long timeout)
Set the time required for concurrent handling to complete.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.从接口继承的方法 org.springframework.web.context.request.NativeWebRequest
getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse
从接口继承的方法 org.springframework.web.context.request.RequestAttributes
getAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttribute
从接口继承的方法 org.springframework.web.context.request.WebRequest
checkNotModified, checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isSecure, isUserInRole
方法详细资料
setTimeout
void setTimeout(@Nullable 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. whenisAsyncStarted()
istrue
.- 参数:
timeout
- amount of time in milliseconds;null
means no timeout, i.e. rely on the default timeout of the container.
addTimeoutHandler
void addTimeoutHandler(Runnable runnable)
Add a handler to invoke when concurrent handling has timed out.
addErrorHandler
void addErrorHandler(Consumer<Throwable> exceptionHandler)
Add a handler to invoke when an error occurred while concurrent handling of a request.- 从以下版本开始:
- 5.0
addCompletionHandler
void addCompletionHandler(Runnable runnable)
Add a handler to invoke when request processing completes.
startAsync
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.- 抛出:
IllegalStateException
- if async processing has completed or is not supported
isAsyncStarted
boolean isAsyncStarted()
Whether the request is in async mode following a call tostartAsync()
. Returns "false" if asynchronous processing never started, has completed, or the request was dispatched for further processing.
dispatch
void dispatch()
Dispatch the request to the container in order to resume processing after concurrent execution in an application thread.
isAsyncComplete
boolean isAsyncComplete()
Whether asynchronous processing has completed.