public interface AsyncContext
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ASYNC_CONTEXT_PATH
The attribute name for the Context Path of the async request
|
static java.lang.String |
ASYNC_MAPPING
The attribute name for the Mapping of the async request
|
static java.lang.String |
ASYNC_PATH_INFO
The attribute name for the Path Info of the async request
|
static java.lang.String |
ASYNC_QUERY_STRING
The attribute name for the Query String of the async request
|
static java.lang.String |
ASYNC_REQUEST_URI
The attribute name for the URI of the async request
|
static java.lang.String |
ASYNC_SERVLET_PATH
The attribute name for the Servlet Path of the async request
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(AsyncListener listener)
Adds an event listener that will be called for different AsyncEvents fire
|
void |
addListener(AsyncListener listener,
ServletRequest request,
ServletResponse response)
Adds an event listener that will be called when different AsyncEvents fire
|
void |
complete()
Completes the async request processing and closes the response stream
|
<T extends AsyncListener> |
createListener(java.lang.Class<T> clazz)
Creates and returns an AsyncListener object
|
void |
dispatch() |
void |
dispatch(ServletContext context,
java.lang.String path) |
void |
dispatch(java.lang.String path) |
ServletRequest |
getRequest() |
ServletResponse |
getResponse() |
long |
getTimeout()
Get the current timeout.
|
boolean |
hasOriginalRequestAndResponse() |
void |
setTimeout(long timeout)
Set the timeout.
|
void |
start(java.lang.Runnable run)
Starts a new thread to process the asynchronous request
|
static final java.lang.String ASYNC_REQUEST_URI
static final java.lang.String ASYNC_CONTEXT_PATH
static final java.lang.String ASYNC_MAPPING
static final java.lang.String ASYNC_PATH_INFO
static final java.lang.String ASYNC_SERVLET_PATH
static final java.lang.String ASYNC_QUERY_STRING
ServletRequest getRequest()
ServletResponse getResponse()
boolean hasOriginalRequestAndResponse()
void dispatch()
java.lang.IllegalStateException
- if this method is called when the request
is not in asynchronous mode. The request is in asynchronous mode after
ServletRequest.startAsync()
or
ServletRequest.startAsync(ServletRequest,
ServletResponse)
has been called and before complete()
or any
other dispatch() method has been called.void dispatch(java.lang.String path)
path
- The path to which the request/response should be dispatched
relative to the ServletContext
from which this async
request was started.java.lang.IllegalStateException
- if this method is called when the request
is not in asynchronous mode. The request is in asynchronous mode after
ServletRequest.startAsync()
or
ServletRequest.startAsync(ServletRequest,
ServletResponse)
has been called and before complete()
or any
other dispatch() method has been called.void dispatch(ServletContext context, java.lang.String path)
path
- The path to which the request/response should be dispatched
relative to the specified ServletContext
.context
- The ServletContext
to which the request/response
should be dispatched.java.lang.IllegalStateException
- if this method is called when the request
is not in asynchronous mode. The request is in asynchronous mode after
ServletRequest.startAsync()
or
ServletRequest.startAsync(ServletRequest,
ServletResponse)
has been called and before complete()
or any
other dispatch() method has been called.void complete()
void start(java.lang.Runnable run)
run
- a Runnable that the new thread will runvoid addListener(AsyncListener listener)
listener
- an AsyncListener that will be called with AsyncEvent objectsvoid addListener(AsyncListener listener, ServletRequest request, ServletResponse response)
listener
- an AsyncListener that will be called with AsyncEvent objectsrequest
- the ServletRequest that will be passed with the AsyncEventresponse
- the ServletResponse that will be passed with the AsyncEvent<T extends AsyncListener> T createListener(java.lang.Class<T> clazz) throws ServletException
T
- The type to create that extends AsyncListenerclazz
- The class to instantiate to create the listenerServletException
- if the listener cannot be createdvoid setTimeout(long timeout)
timeout
- The timeout in milliseconds. 0 or less indicates no
timeout.long getTimeout()
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.