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
ConstructorsConstructorDescriptionServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response) Constructor accepting a request and response pair that are expected to be of typeServletServerHttpRequestandServletServerHttpResponserespectively. -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Mark asynchronous request processing as completed.booleanReturn whether asynchronous request processing has been completed.booleanReturn whether asynchronous request processing has been started.voidonComplete(AsyncEvent event) voidonError(AsyncEvent event) voidonStartAsync(AsyncEvent event) voidonTimeout(AsyncEvent event) voidstart()Enable asynchronous processing after which the response remains open until a call toServerHttpAsyncRequestControl.complete()is made or the server times out the request.voidstart(long timeout) A variation onServerHttpAsyncRequestControl.start()that allows specifying a timeout value to use to use for asynchronous processing.
-
Constructor Details
-
ServletServerHttpAsyncRequestControl
public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response) Constructor accepting a request and response pair that are expected to be of typeServletServerHttpRequestandServletServerHttpResponserespectively.
-
-
Method Details
-
isStarted
public boolean isStarted()Description copied from interface:ServerHttpAsyncRequestControlReturn whether asynchronous request processing has been started.- Specified by:
isStartedin interfaceServerHttpAsyncRequestControl
-
isCompleted
public boolean isCompleted()Description copied from interface:ServerHttpAsyncRequestControlReturn whether asynchronous request processing has been completed.- Specified by:
isCompletedin interfaceServerHttpAsyncRequestControl
-
start
public void start()Description copied from interface:ServerHttpAsyncRequestControlEnable asynchronous processing after which the response remains open until a call toServerHttpAsyncRequestControl.complete()is made or the server times out the request. Once enabled, additional calls to this method are ignored.- Specified by:
startin interfaceServerHttpAsyncRequestControl
-
start
public void start(long timeout) Description copied from interface:ServerHttpAsyncRequestControlA variation onServerHttpAsyncRequestControl.start()that allows specifying a timeout value to use to use for asynchronous processing. IfServerHttpAsyncRequestControl.complete()is not called within the specified value, the request times out.- Specified by:
startin interfaceServerHttpAsyncRequestControl
-
complete
public void complete()Description copied from interface:ServerHttpAsyncRequestControlMark asynchronous request processing as completed.- Specified by:
completein interfaceServerHttpAsyncRequestControl
-
onComplete
- Specified by:
onCompletein interfaceAsyncListener- Throws:
IOException
-
onStartAsync
- Specified by:
onStartAsyncin interfaceAsyncListener- Throws:
IOException
-
onError
- Specified by:
onErrorin interfaceAsyncListener- Throws:
IOException
-
onTimeout
- Specified by:
onTimeoutin interfaceAsyncListener- Throws:
IOException
-