Package org.apache.catalina.core
Class AsyncContextImpl
- java.lang.Object
- 
- org.apache.catalina.core.AsyncContextImpl
 
- 
- All Implemented Interfaces:
- AsyncContext,- AsyncContextCallback
 
 public class AsyncContextImpl extends java.lang.Object implements AsyncContext, AsyncContextCallback 
- 
- 
Field SummaryFields Modifier and Type Field Description protected static StringManagersm- 
Fields inherited from interface javax.servlet.AsyncContextASYNC_CONTEXT_PATH, ASYNC_MAPPING, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH
 
- 
 - 
Constructor SummaryConstructors Constructor Description AsyncContextImpl(Request request)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(AsyncListener listener)Adds an event listener that will be called for different AsyncEvents firevoidaddListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse)Adds an event listener that will be called when different AsyncEvents firevoidcomplete()Completes the async request processing and closes the response stream<T extends AsyncListener>
 TcreateListener(java.lang.Class<T> clazz)Creates and returns an AsyncListener objectvoiddecrementInProgressAsyncCount()Used to notify the Context that async processing has ended.voiddispatch()voiddispatch(java.lang.String path)voiddispatch(ServletContext servletContext, java.lang.String path)protected voiddoInternalDispatch()voidfireOnComplete()ServletRequestgetRequest()ServletResponsegetResponse()longgetTimeout()Get the current timeout.booleanhasOriginalRequestAndResponse()voidincrementInProgressAsyncCount()Used to notify the Context that async processing has started.booleanisAvailable()Reports if the web application associated with this async request is available.booleanisStarted()voidrecycle()voidsetErrorState(java.lang.Throwable t, boolean fireOnError)voidsetStarted(Context context, ServletRequest request, ServletResponse response, boolean originalRequestResponse)voidsetTimeout(long timeout)Set the timeout.voidstart(java.lang.Runnable run)Starts a new thread to process the asynchronous requestbooleantimeout()
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm 
 
- 
 - 
Constructor Detail- 
AsyncContextImplpublic AsyncContextImpl(Request request) 
 
- 
 - 
Method Detail- 
completepublic void complete() Description copied from interface:javax.servlet.AsyncContextCompletes the async request processing and closes the response stream- Specified by:
- completein interface- AsyncContext
 
 - 
fireOnCompletepublic void fireOnComplete() - Specified by:
- fireOnCompletein interface- AsyncContextCallback
 
 - 
timeoutpublic boolean timeout() 
 - 
dispatchpublic void dispatch() - Specified by:
- dispatchin interface- AsyncContext
 
 - 
dispatchpublic void dispatch(java.lang.String path) - Specified by:
- dispatchin interface- AsyncContext
- Parameters:
- path- The path to which the request/response should be dispatched relative to the- ServletContextfrom which this async request was started.
 
 - 
dispatchpublic void dispatch(ServletContext servletContext, java.lang.String path) - Specified by:
- dispatchin interface- AsyncContext
- Parameters:
- servletContext- The- ServletContextto which the request/response should be dispatched.
- path- The path to which the request/response should be dispatched relative to the specified- ServletContext.
 
 - 
getRequestpublic ServletRequest getRequest() - Specified by:
- getRequestin interface- AsyncContext
- Returns:
- a reference to the ServletRequest object
 
 - 
getResponsepublic ServletResponse getResponse() - Specified by:
- getResponsein interface- AsyncContext
- Returns:
- a reference to the ServletResponse object
 
 - 
startpublic void start(java.lang.Runnable run) Description copied from interface:javax.servlet.AsyncContextStarts a new thread to process the asynchronous request- Specified by:
- startin interface- AsyncContext
- Parameters:
- run- a Runnable that the new thread will run
 
 - 
addListenerpublic void addListener(AsyncListener listener) Description copied from interface:javax.servlet.AsyncContextAdds an event listener that will be called for different AsyncEvents fire- Specified by:
- addListenerin interface- AsyncContext
- Parameters:
- listener- an AsyncListener that will be called with AsyncEvent objects
 
 - 
addListenerpublic void addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) Description copied from interface:javax.servlet.AsyncContextAdds an event listener that will be called when different AsyncEvents fire- Specified by:
- addListenerin interface- AsyncContext
- Parameters:
- listener- an AsyncListener that will be called with AsyncEvent objects
- servletRequest- the ServletRequest that will be passed with the AsyncEvent
- servletResponse- the ServletResponse that will be passed with the AsyncEvent
 
 - 
createListenerpublic <T extends AsyncListener> T createListener(java.lang.Class<T> clazz) throws ServletException Description copied from interface:javax.servlet.AsyncContextCreates and returns an AsyncListener object- Specified by:
- createListenerin interface- AsyncContext
- Type Parameters:
- T- The type to create that extends AsyncListener
- Parameters:
- clazz- The class to instantiate to create the listener
- Returns:
- the newly created AsyncListener object
- Throws:
- ServletException- if the listener cannot be created
 
 - 
recyclepublic void recycle() 
 - 
isStartedpublic boolean isStarted() 
 - 
setStartedpublic void setStarted(Context context, ServletRequest request, ServletResponse response, boolean originalRequestResponse) 
 - 
hasOriginalRequestAndResponsepublic boolean hasOriginalRequestAndResponse() - Specified by:
- hasOriginalRequestAndResponsein interface- AsyncContext
- Returns:
- true if the Request and Response are the original ones
 
 - 
doInternalDispatchprotected void doInternalDispatch() throws ServletException, java.io.IOException- Throws:
- ServletException
- java.io.IOException
 
 - 
getTimeoutpublic long getTimeout() Description copied from interface:javax.servlet.AsyncContextGet the current timeout.- Specified by:
- getTimeoutin interface- AsyncContext
- Returns:
- The timeout in milliseconds. 0 or less indicates no timeout.
 
 - 
setTimeoutpublic void setTimeout(long timeout) Description copied from interface:javax.servlet.AsyncContextSet the timeout.- Specified by:
- setTimeoutin interface- AsyncContext
- Parameters:
- timeout- The timeout in milliseconds. 0 or less indicates no timeout.
 
 - 
isAvailablepublic boolean isAvailable() Description copied from interface:AsyncContextCallbackReports if the web application associated with this async request is available.- Specified by:
- isAvailablein interface- AsyncContextCallback
- Returns:
- trueif the associated web application is available, otherwise- false
 
 - 
setErrorStatepublic void setErrorState(java.lang.Throwable t, boolean fireOnError)
 - 
incrementInProgressAsyncCountpublic void incrementInProgressAsyncCount() Description copied from interface:AsyncContextCallbackUsed to notify the Context that async processing has started. Specifically, for the counting of in-progress async requests to work correctly, this must be called exactly once every time theAsyncStateMachinetransitions from DISPATCHED to any other state.- Specified by:
- incrementInProgressAsyncCountin interface- AsyncContextCallback
 
 - 
decrementInProgressAsyncCountpublic void decrementInProgressAsyncCount() Description copied from interface:AsyncContextCallbackUsed to notify the Context that async processing has ended. Specifically, for the counting of in-progress async requests to work correctly, this must be called exactly once every time theAsyncStateMachinetransitions to DISPATCHED from any other state.- Specified by:
- decrementInProgressAsyncCountin interface- AsyncContextCallback
 
 
- 
 
-