public class TimeoutDeferredResultProcessingInterceptor extends java.lang.Object implements DeferredResultProcessingInterceptor
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.
Constructor and Description |
---|
TimeoutDeferredResultProcessingInterceptor() |
Modifier and Type | Method and Description |
---|---|
<T> boolean |
handleTimeout(NativeWebRequest request,
DeferredResult<T> result)
Invoked from a container thread when an async request times out before
the
DeferredResult has been set. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterCompletion, beforeConcurrentHandling, handleError, postProcess, preProcess
public TimeoutDeferredResultProcessingInterceptor()
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> result) throws java.lang.Exception
DeferredResultProcessingInterceptor
DeferredResult
has been set. Implementations may invoke
setResult
or
setErrorResult
to resume processing.handleTimeout
in interface DeferredResultProcessingInterceptor
request
- the current requestresult
- the DeferredResult for the current request; if the
DeferredResult
is set, then concurrent processing is resumed and
subsequent interceptors are not invokedtrue
if processing should continue, or false
if
other interceptors should not be invokedjava.lang.Exception
- in case of errors