Top Description Fields Constructors Methods
org.springframework.http.server

public Class ServletServerHttpAsyncRequestControl

extends Object
implements ServerHttpAsyncRequestControl, AsyncListener
Class Inheritance
All Implemented Interfaces
jakarta.servlet.AsyncListener, java.util.EventListener, org.springframework.http.server.ServerHttpAsyncRequestControl
Imports
java.io.IOException, java.util.concurrent.atomic.AtomicBoolean, jakarta.servlet.AsyncContext, .AsyncEvent, .AsyncListener, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.lang.Nullable, org.springframework.util.Assert

A ServerHttpAsyncRequestControl to use on Servlet containers.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
private AsyncContext
private static final long
private final ServletServerHttpRequest
private final ServletServerHttpResponse

Constructor Summary

AccessConstructor and Description
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 Summary

Modifier and TypeMethod and Description
public void
complete()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.complete.

Mark asynchronous request processing as completed.

public boolean
isCompleted()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.isCompleted.

Return whether asynchronous request processing has been completed.

public boolean
isStarted()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.isStarted.

Return whether asynchronous request processing has been started.

public void
onComplete(AsyncEvent
Provides access to the objects associated with the event
event
)

Implements jakarta.servlet.AsyncListener.onComplete.

This event is fired after the call to AsyncContext#complete() has been processed by the container.

public void
onError(AsyncEvent
Provides access to the objects associated with the event
event
)

Implements jakarta.servlet.AsyncListener.onError.

This event is fired if an error occurs during an asynchronous operation but before the container takes any action as a result of the error.

public void
onStartAsync(AsyncEvent
Provides access to the objects associated with the event
event
)

Implements jakarta.servlet.AsyncListener.onStartAsync.

This event is fired if new call is made to ServletRequest#startAsync() after the completion of the AsyncContext to which this listener was added.

public void
onTimeout(AsyncEvent
Provides access to the objects associated with the event
event
)

Implements jakarta.servlet.AsyncListener.onTimeout.

This event is fired if an asynchronous operation times out but before the container takes any action as a result of the timeout.

public void
start()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.start.

Enable asynchronous processing after which the response remains open until a call to complete() is made or the server times out the request.

public void
start(long timeout)

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.start.

A variation on start() that allows specifying a timeout value to use for asynchronous processing.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

asyncCompletedback to summary
private final AtomicBoolean asyncCompleted
asyncContextback to summary
private AsyncContext asyncContext
Annotations
@Nullable
NO_TIMEOUT_VALUEback to summary
private static final long NO_TIMEOUT_VALUE
requestback to summary
private final ServletServerHttpRequest request
responseback to summary
private final ServletServerHttpResponse response

Constructor Detail

ServletServerHttpAsyncRequestControlback to summary
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

completeback to summary
public void complete()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.complete.

Doc from org.springframework.http.server.ServerHttpAsyncRequestControl.complete.

Mark asynchronous request processing as completed.

Annotations
@Override
isCompletedback to summary
public boolean isCompleted()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.isCompleted.

Doc from org.springframework.http.server.ServerHttpAsyncRequestControl.isCompleted.

Return whether asynchronous request processing has been completed.

Annotations
@Override
isStartedback to summary
public boolean isStarted()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.isStarted.

Doc from org.springframework.http.server.ServerHttpAsyncRequestControl.isStarted.

Return whether asynchronous request processing has been started.

Annotations
@Override
onCompleteback to summary
public void onComplete(AsyncEvent event) throws IOException

Implements jakarta.servlet.AsyncListener.onComplete.

Doc from jakarta.servlet.AsyncListener.onComplete.

This event is fired after the call to AsyncContext#complete() has been processed by the container.

Parameters
event:AsyncEvent

Provides access to the objects associated with the event

Annotations
@Override
Exceptions
IOException:
Should be thrown if an I/O error occurs during the processing of the event
onErrorback to summary
public void onError(AsyncEvent event) throws IOException

Implements jakarta.servlet.AsyncListener.onError.

Doc from jakarta.servlet.AsyncListener.onError.

This event is fired if an error occurs during an asynchronous operation but before the container takes any action as a result of the error.

Parameters
event:AsyncEvent

Provides access to the objects associated with the event

Annotations
@Override
Exceptions
IOException:
Should be thrown if an I/O error occurs during the processing of the event
onStartAsyncback to summary
public void onStartAsync(AsyncEvent event) throws IOException

Implements jakarta.servlet.AsyncListener.onStartAsync.

Doc from jakarta.servlet.AsyncListener.onStartAsync.

This event is fired if new call is made to ServletRequest#startAsync() after the completion of the AsyncContext to which this listener was added.

Parameters
event:AsyncEvent

Provides access to the objects associated with the event

Annotations
@Override
Exceptions
IOException:
Should be thrown if an I/O error occurs during the processing of the event
onTimeoutback to summary
public void onTimeout(AsyncEvent event) throws IOException

Implements jakarta.servlet.AsyncListener.onTimeout.

Doc from jakarta.servlet.AsyncListener.onTimeout.

This event is fired if an asynchronous operation times out but before the container takes any action as a result of the timeout.

Parameters
event:AsyncEvent

Provides access to the objects associated with the event

Annotations
@Override
Exceptions
IOException:
Should be thrown if an I/O error occurs during the processing of the event
startback to summary
public void start()

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.start.

Doc from org.springframework.http.server.ServerHttpAsyncRequestControl.start.

Enable asynchronous processing after which the response remains open until a call to complete() is made or the server times out the request. Once enabled, additional calls to this method are ignored.

Annotations
@Override
startback to summary
public void start(long timeout)

Implements org.springframework.http.server.ServerHttpAsyncRequestControl.start.

Doc from org.springframework.http.server.ServerHttpAsyncRequestControl.start.

A variation on start() that allows specifying a timeout value to use for asynchronous processing. If complete() is not called within the specified value, the request times out.

Annotations
@Override