Package 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
AServerHttpAsyncRequestControlto use on Servlet containers (Servlet 3.0+).- 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 typeServletServerHttpRequestandServletServerHttpResponserespectively.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete()Mark asynchronous request processing as completed.booleanisCompleted()Return whether asynchronous request processing has been completed.booleanisStarted()Return 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 Detail
ServletServerHttpAsyncRequestControl
public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response)
Constructor accepting a request and response pair that are expected to be of typeServletServerHttpRequestandServletServerHttpResponserespectively.
Method Detail
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
public void onComplete(AsyncEvent event) throws IOException
- Specified by:
onCompletein interfaceAsyncListener- Throws:
IOException
onStartAsync
public void onStartAsync(AsyncEvent event) throws IOException
- Specified by:
onStartAsyncin interfaceAsyncListener- Throws:
IOException
onError
public void onError(AsyncEvent event) throws IOException
- Specified by:
onErrorin interfaceAsyncListener- Throws:
IOException
onTimeout
public void onTimeout(AsyncEvent event) throws IOException
- Specified by:
onTimeoutin interfaceAsyncListener- Throws:
IOException