org.springframework.http.server

## Class ServletServerHttpAsyncRequestControl

- java.lang.Object
- - org.springframework.http.server.ServletServerHttpAsyncRequestControl

- All Implemented Interfaces:
    EventListener, AsyncListener, ServerHttpAsyncRequestControl

      public class ServletServerHttpAsyncRequestControl
      extends Object
      implements ServerHttpAsyncRequestControl, AsyncListener

  A `ServerHttpAsyncRequestControl` to use on Servlet containers (Servlet 3.0+).
  Since:
    4.0
  Author:
    Rossen Stoyanchev

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response)` Constructor accepting a request and response pair that are expected to be of type `ServletServerHttpRequest` and `ServletServerHttpResponse` respectively.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `complete()` Causes asynchronous request processing to be completed.
    `boolean` | `isCompleted()` Whether asynchronous request processing has been completed.
    `boolean` | `isStarted()` Whether asynchronous request processing has been started.
    `void` | `onComplete(AsyncEvent event)`
    `void` | `onError(AsyncEvent event)`
    `void` | `onStartAsync(AsyncEvent event)`
    `void` | `onTimeout(AsyncEvent event)`
    `void` | `start()` Enable asynchronous processing after which the response remains open until a call to `ServerHttpAsyncRequestControl.complete()` is made or the server times out the request.
    `void` | `start(long timeout)` A variation on `ServerHttpAsyncRequestControl.start()` that allows specifying a timeout value to use to use for asynchronous processing.

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

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

- - ### Constructor Detail

    - #### ServletServerHttpAsyncRequestControl

          public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request,
                                                      ServletServerHttpResponse response)

      Constructor accepting a request and response pair that are expected to be of type `ServletServerHttpRequest` and `ServletServerHttpResponse` respectively.

  - ### Method Detail

    - #### isStarted

          public boolean isStarted()

      Description copied from interface: `ServerHttpAsyncRequestControl`
      Whether asynchronous request processing has been started.
      Specified by:
        `isStarted` in interface `ServerHttpAsyncRequestControl`

    - #### isCompleted

          public boolean isCompleted()

      Description copied from interface: `ServerHttpAsyncRequestControl`
      Whether asynchronous request processing has been completed.
      Specified by:
        `isCompleted` in interface `ServerHttpAsyncRequestControl`

    - #### start

          public void start()

      Description copied from interface: `ServerHttpAsyncRequestControl`
      Enable asynchronous processing after which the response remains open until a call to `ServerHttpAsyncRequestControl.complete()` is made or the server times out the request. Once enabled, additional calls to this method are ignored.
      Specified by:
        `start` in interface `ServerHttpAsyncRequestControl`

    - #### start

          public void start(long timeout)

      Description copied from interface: `ServerHttpAsyncRequestControl`
      A variation on `ServerHttpAsyncRequestControl.start()` that allows specifying a timeout value to use to use for asynchronous processing. If `ServerHttpAsyncRequestControl.complete()` is not called within the specified value, the request times out.
      Specified by:
        `start` in interface `ServerHttpAsyncRequestControl`

    - #### complete

          public void complete()

      Description copied from interface: `ServerHttpAsyncRequestControl`
      Causes asynchronous request processing to be completed.
      Specified by:
        `complete` in interface `ServerHttpAsyncRequestControl`

    - #### onComplete

          public void onComplete(AsyncEvent event)
                          throws IOException

      Specified by:
        `onComplete` in interface `AsyncListener`
      Throws:
        `IOException`

    - #### onStartAsync

          public void onStartAsync(AsyncEvent event)
                            throws IOException

      Specified by:
        `onStartAsync` in interface `AsyncListener`
      Throws:
        `IOException`

    - #### onError

          public void onError(AsyncEvent event)
                       throws IOException

      Specified by:
        `onError` in interface `AsyncListener`
      Throws:
        `IOException`

    - #### onTimeout

          public void onTimeout(AsyncEvent event)
                         throws IOException

      Specified by:
        `onTimeout` in interface `AsyncListener`
      Throws:
        `IOException`