Package org.springframework.http.server

# Class ServletServerHttpAsyncRequestControl

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

All Implemented Interfaces:
  `AsyncListener`, `EventListener`, `ServerHttpAsyncRequestControl`

public class ServletServerHttpAsyncRequestControl extends Object implements ServerHttpAsyncRequestControl, AsyncListener
A `ServerHttpAsyncRequestControl` to use on Servlet containers.

Since:
  4.0
Author:
  Rossen Stoyanchev

## Constructor Summary

Constructors
Constructor
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

Modifier and Type
Method
Description
`void`
`complete()`
Mark asynchronous request processing as completed.
`boolean`
`isCompleted()`
Return whether asynchronous request processing has been completed.
`boolean`
`isStarted()`
Return 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 for asynchronous processing.

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

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

## Constructor Details

### 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 Details

### isStarted

public boolean isStarted()
Description copied from interface: `ServerHttpAsyncRequestControl`
Return whether asynchronous request processing has been started.

Specified by:
  `isStarted` in interface `ServerHttpAsyncRequestControl`

### isCompleted

public boolean isCompleted()
Description copied from interface: `ServerHttpAsyncRequestControl`
Return 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 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`
Mark asynchronous request processing as completed.

Specified by:
  `complete` in interface `ServerHttpAsyncRequestControl`

### onStartAsync

public void onStartAsync(AsyncEvent event) throws IOException

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

### onTimeout

public void onTimeout(AsyncEvent event) throws IOException

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

### onError

public void onError(AsyncEvent event) throws IOException

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

### onComplete

public void onComplete(AsyncEvent event) throws IOException

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