类 TimeoutCallableProcessingInterceptor
- java.lang.Object
- org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
- org.springframework.web.context.request.async.TimeoutCallableProcessingInterceptor
- 所有已实现的接口:
CallableProcessingInterceptor
public class TimeoutCallableProcessingInterceptor extends CallableProcessingInterceptorAdapter
Sends a 503 (SERVICE_UNAVAILABLE) in case of a timeout if the response is not already committed. As of 4.2.8 this is done indirectly by setting the result to anAsyncRequestTimeoutException
which is then handled by Spring MVC's default exception handling as a 503 error.Registered at the end, after all other interceptors and therefore invoked only if no other interceptor handles the timeout.
Note that according to RFC 7231, a 503 without a 'Retry-After' header is interpreted as a 500 error and the client should not retry. Applications can install their own interceptor to handle a timeout and add a 'Retry-After' header if necessary.
- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
字段概要
从接口继承的字段 org.springframework.web.context.request.async.CallableProcessingInterceptor
RESPONSE_HANDLED, RESULT_NONE
构造器概要
构造器 构造器 说明 TimeoutCallableProcessingInterceptor()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 <T> Object
handleTimeout(NativeWebRequest request, Callable<T> task)
This implementation always returnsRESULT_NONE
.从类继承的方法 org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter
afterCompletion, beforeConcurrentHandling, postProcess, preProcess
构造器详细资料
TimeoutCallableProcessingInterceptor
public TimeoutCallableProcessingInterceptor()
方法详细资料
handleTimeout
public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception
从类复制的说明:CallableProcessingInterceptorAdapter
This implementation always returnsRESULT_NONE
.- 指定者:
handleTimeout
在接口中CallableProcessingInterceptor
- 覆盖:
handleTimeout
在类中CallableProcessingInterceptorAdapter
- 参数:
request
- the current requesttask
- the task for the current async request- 返回:
- a concurrent result value; if the value is anything other than
CallableProcessingInterceptor.RESULT_NONE
orCallableProcessingInterceptor.RESPONSE_HANDLED
, concurrent processing is resumed and subsequent interceptors are not invoked - 抛出:
Exception
- in case of errors