org.springframework.web.context.request.async

## Class TimeoutDeferredResultProcessingInterceptor

- java.lang.Object
- - org.springframework.web.context.request.async.DeferredResultProcessingInterceptorAdapter
  - - org.springframework.web.context.request.async.TimeoutDeferredResultProcessingInterceptor

- All Implemented Interfaces:
    DeferredResultProcessingInterceptor

      public class TimeoutDeferredResultProcessingInterceptor
      extends DeferredResultProcessingInterceptorAdapter

  Sends a 503 (SERVICE_UNAVAILABLE) in case of a timeout if the response is not already committed. Registered at the end, after all other interceptors and therefore invoked only if no other interceptor handles the timeout.

  Note that according to RFC 2616, 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.

  Since:
    3.2
  Author:
    Rossen Stoyanchev

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeoutDeferredResultProcessingInterceptor()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> boolean` | `handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult)` This implementation returns `true` by default allowing other interceptors to be given a chance to handle the timeout.

    - ### Methods inherited from class org.springframework.web.context.request.async.DeferredResultProcessingInterceptorAdapter

      `afterCompletion, beforeConcurrentHandling, postProcess, preProcess`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimeoutDeferredResultProcessingInterceptor

          public TimeoutDeferredResultProcessingInterceptor()

  - ### Method Detail

    - #### handleTimeout

          public <T> boolean handleTimeout(NativeWebRequest request,
                                  DeferredResult<T> deferredResult)
                                throws Exception

      Description copied from class: `DeferredResultProcessingInterceptorAdapter`
      This implementation returns `true` by default allowing other interceptors to be given a chance to handle the timeout.
      Specified by:
        `handleTimeout` in interface `DeferredResultProcessingInterceptor`
      Overrides:
        `handleTimeout` in class `DeferredResultProcessingInterceptorAdapter`
      Parameters:
        `request` - the current request
        `deferredResult` - the DeferredResult for the current request; if the `DeferredResult` is set, then concurrent processing is resumed and subsequent interceptors are not invoked
      Returns:
        `true` if processing should continue, or `false` if other interceptors should not be invoked
      Throws:
        `Exception` - in case of errors