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

public Class TimeoutDeferredResultProcessingInterceptor

extends Object
implements DeferredResultProcessingInterceptor
Class Inheritance
All Implemented Interfaces
org.springframework.web.context.request.async.DeferredResultProcessingInterceptor
Imports
org.springframework.web.context.request.NativeWebRequest

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 returning AsyncRequestTimeoutException as the result of processing 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.

Author
Rossen Stoyanchev
Since
3.2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T> boolean
handleTimeout(NativeWebRequest
the current request
request
,
DeferredResult<T>
the DeferredResult for the current request; if the DeferredResult is set, then concurrent processing is resumed and subsequent interceptors are not invoked
result
)

Overrides default org.springframework.web.context.request.async.DeferredResultProcessingInterceptor.handleTimeout.

Invoked from a container thread when an async request times out before the DeferredResult has been set.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TimeoutDeferredResultProcessingInterceptorback to summary
public TimeoutDeferredResultProcessingInterceptor()

Method Detail

handleTimeoutback to summary
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> result) throws Exception

Overrides default org.springframework.web.context.request.async.DeferredResultProcessingInterceptor.handleTimeout.

Doc from org.springframework.web.context.request.async.DeferredResultProcessingInterceptor.handleTimeout.

Invoked from a container thread when an async request times out before the DeferredResult has been set. Implementations may invoke setResult or setErrorResult to resume processing.

Parameters
request:NativeWebRequest

the current request

result:DeferredResult<T>

the DeferredResult for the current request; if the DeferredResult is set, then concurrent processing is resumed and subsequent interceptors are not invoked

Returns:boolean

true if processing should continue, or false if other interceptors should not be invoked

Annotations
@Override
Exceptions
Exception:
in case of errors