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
AServerHttpAsyncRequestControl
to 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 typeServletServerHttpRequest
andServletServerHttpResponse
respectively.
Method Summary
All Methods Instance Methods Concrete Methods 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 toServerHttpAsyncRequestControl.complete()
is made or the server times out the request.void
start(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 typeServletServerHttpRequest
andServletServerHttpResponse
respectively.
Method Detail
isStarted
public boolean isStarted()
Description copied from interface:ServerHttpAsyncRequestControl
Return whether asynchronous request processing has been started.- Specified by:
isStarted
in interfaceServerHttpAsyncRequestControl
isCompleted
public boolean isCompleted()
Description copied from interface:ServerHttpAsyncRequestControl
Return whether asynchronous request processing has been completed.- Specified by:
isCompleted
in interfaceServerHttpAsyncRequestControl
start
public void start()
Description copied from interface:ServerHttpAsyncRequestControl
Enable 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:
start
in interfaceServerHttpAsyncRequestControl
start
public void start(long timeout)
Description copied from interface:ServerHttpAsyncRequestControl
A 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:
start
in interfaceServerHttpAsyncRequestControl
complete
public void complete()
Description copied from interface:ServerHttpAsyncRequestControl
Mark asynchronous request processing as completed.- Specified by:
complete
in interfaceServerHttpAsyncRequestControl
onComplete
public void onComplete(AsyncEvent event) throws IOException
- Specified by:
onComplete
in interfaceAsyncListener
- Throws:
IOException
onStartAsync
public void onStartAsync(AsyncEvent event) throws IOException
- Specified by:
onStartAsync
in interfaceAsyncListener
- Throws:
IOException
onError
public void onError(AsyncEvent event) throws IOException
- Specified by:
onError
in interfaceAsyncListener
- Throws:
IOException
onTimeout
public void onTimeout(AsyncEvent event) throws IOException
- Specified by:
onTimeout
in interfaceAsyncListener
- Throws:
IOException