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
ConstructorDescriptionServletServerHttpAsyncRequestControl
(ServletServerHttpRequest request, ServletServerHttpResponse response) Constructor accepting a request and response pair that are expected to be of typeServletServerHttpRequest
andServletServerHttpResponse
respectively. -
Method Summary
Modifier and TypeMethodDescriptionvoid
complete()
Mark asynchronous request processing as completed.boolean
Return whether asynchronous request processing has been completed.boolean
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 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 typeServletServerHttpRequest
andServletServerHttpResponse
respectively.
-
-
Method Details
-
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 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
- Specified by:
onComplete
in interfaceAsyncListener
- Throws:
IOException
-
onStartAsync
- Specified by:
onStartAsync
in interfaceAsyncListener
- Throws:
IOException
-
onError
- Specified by:
onError
in interfaceAsyncListener
- Throws:
IOException
-
onTimeout
- Specified by:
onTimeout
in interfaceAsyncListener
- Throws:
IOException
-