public class ServletServerHttpAsyncRequestControl extends java.lang.Object implements ServerHttpAsyncRequestControl, AsyncListener
ServerHttpAsyncRequestControl
to use on Servlet containers (Servlet 3.0+).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)
Notifies this AsyncListener that an asynchronous operation
has been completed.
|
void |
onError(AsyncEvent event)
Notifies this AsyncListener that an asynchronous operation
has failed to complete.
|
void |
onStartAsync(AsyncEvent event)
Notifies this AsyncListener that a new asynchronous cycle is being
initiated via a call to one of the
ServletRequest.startAsync()
methods. |
void |
onTimeout(AsyncEvent event)
Notifies this AsyncListener that an asynchronous operation
has timed out.
|
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. |
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
javax.servlet.AsyncListener
The AsyncContext
corresponding to the asynchronous
operation that has been completed may be obtained by calling
getAsyncContext
on the given
event.
In addition, if this AsyncListener had been registered via a call
to AsyncContext.addListener(AsyncListener,
ServletRequest, ServletResponse)
, the supplied ServletRequest and
ServletResponse objects may be retrieved by calling
getSuppliedRequest
and
getSuppliedResponse
,
respectively, on the given event.
onComplete
in interface AsyncListener
event
- the AsyncEvent indicating that an asynchronous
operation has been completedjava.io.IOException
- if an I/O related error has occurred during the
processing of the given AsyncEventpublic void onStartAsync(AsyncEvent event) throws java.io.IOException
javax.servlet.AsyncListener
ServletRequest.startAsync()
methods.
The AsyncContext
corresponding to the asynchronous
operation that is being reinitialized may be obtained by calling
getAsyncContext
on the given
event.
In addition, if this AsyncListener had been registered via a call
to AsyncContext.addListener(AsyncListener,
ServletRequest, ServletResponse)
, the supplied ServletRequest and
ServletResponse objects may be retrieved by calling
getSuppliedRequest
and
getSuppliedResponse
,
respectively, on the given event.
This AsyncListener will not receive any events related to the
new asynchronous cycle unless it registers itself (via a call
to AsyncContext.addListener(javax.servlet.AsyncListener)
) with the AsyncContext that
is delivered as part of the given AsyncEvent.
onStartAsync
in interface AsyncListener
event
- the AsyncEvent indicating that a new asynchronous
cycle is being initiatedjava.io.IOException
- if an I/O related error has occurred during the
processing of the given AsyncEventpublic void onError(AsyncEvent event) throws java.io.IOException
javax.servlet.AsyncListener
The AsyncContext
corresponding to the asynchronous
operation that failed to complete may be obtained by calling
getAsyncContext
on the given
event.
In addition, if this AsyncListener had been registered via a call
to AsyncContext.addListener(AsyncListener,
ServletRequest, ServletResponse)
, the supplied ServletRequest and
ServletResponse objects may be retrieved by calling
getSuppliedRequest
and
getSuppliedResponse
,
respectively, on the given event.
onError
in interface AsyncListener
event
- the AsyncEvent indicating that an asynchronous
operation has failed to completejava.io.IOException
- if an I/O related error has occurred during the
processing of the given AsyncEventpublic void onTimeout(AsyncEvent event) throws java.io.IOException
javax.servlet.AsyncListener
The AsyncContext
corresponding to the asynchronous
operation that has timed out may be obtained by calling
getAsyncContext
on the given
event.
In addition, if this AsyncListener had been registered via a call
to AsyncContext.addListener(AsyncListener,
ServletRequest, ServletResponse)
, the supplied ServletRequest and
ServletResponse objects may be retrieved by calling
getSuppliedRequest
and
getSuppliedResponse
,
respectively, on the given event.
onTimeout
in interface AsyncListener
event
- the AsyncEvent indicating that an asynchronous
operation has timed outjava.io.IOException
- if an I/O related error has occurred during the
processing of the given AsyncEvent