public class ServletServerHttpAsyncRequestControl extends java.lang.Object implements ServerHttpAsyncRequestControl
ServerHttpAsyncRequestControl
to use on Servlet containers (Servlet 3.0+).Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicBoolean |
asyncCompleted |
private AsyncContext |
asyncContext |
private static long |
NO_TIMEOUT_VALUE |
private ServletServerHttpRequest |
request |
private ServletServerHttpResponse |
response |
Constructor and Description |
---|
ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request,
ServletServerHttpResponse response)
Constructor accepting a request and response pair that are expected to be of type
ServletServerHttpRequest and ServletServerHttpResponse
respectively. |
Modifier and Type | Method and 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
to
ServerHttpAsyncRequestControl.complete() is made or the server times out the request. |
void |
start(long timeout)
A variation on
ServerHttpAsyncRequestControl.start() that allows specifying a timeout value to use to
use for asynchronous processing. |
private static long NO_TIMEOUT_VALUE
private final ServletServerHttpRequest request
private final ServletServerHttpResponse response
private AsyncContext asyncContext
private java.util.concurrent.atomic.AtomicBoolean asyncCompleted
public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response)
ServletServerHttpRequest
and ServletServerHttpResponse
respectively.public boolean isStarted()
ServerHttpAsyncRequestControl
isStarted
in interface ServerHttpAsyncRequestControl
public boolean isCompleted()
ServerHttpAsyncRequestControl
isCompleted
in interface ServerHttpAsyncRequestControl
public void start()
ServerHttpAsyncRequestControl
ServerHttpAsyncRequestControl.complete()
is made or the server times out the request. Once enabled,
additional calls to this method are ignored.start
in interface ServerHttpAsyncRequestControl
public void start(long timeout)
ServerHttpAsyncRequestControl
ServerHttpAsyncRequestControl.start()
that allows specifying a timeout value to use to
use for asynchronous processing. If ServerHttpAsyncRequestControl.complete()
is not called within the
specified value, the request times out.start
in interface ServerHttpAsyncRequestControl
public void complete()
ServerHttpAsyncRequestControl
complete
in interface ServerHttpAsyncRequestControl
public void onComplete(AsyncEvent event) throws java.io.IOException
java.io.IOException
public void onStartAsync(AsyncEvent event) throws java.io.IOException
java.io.IOException
public void onError(AsyncEvent event) throws java.io.IOException
java.io.IOException
public void onTimeout(AsyncEvent event) throws java.io.IOException
java.io.IOException