Package io.undertow.servlet.spec
Class AsyncContextImpl
- java.lang.Object
-
- io.undertow.servlet.spec.AsyncContextImpl
-
- All Implemented Interfaces:
javax.servlet.AsyncContext
public class AsyncContextImpl extends Object implements javax.servlet.AsyncContext
- Author:
- Stuart Douglas
-
-
Constructor Summary
Constructors Constructor Description AsyncContextImpl(io.undertow.server.HttpServerExchange exchange, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, ServletRequestContext servletRequestContext, boolean requestSupplied, AsyncContextImpl previousAsyncContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAsyncTask(Runnable runnable)Adds a task to be run to the async context.voidaddListener(javax.servlet.AsyncListener listener)voidaddListener(javax.servlet.AsyncListener listener, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)voidcomplete()voidcompleteInternal(boolean forceComplete)<T extends javax.servlet.AsyncListener>
TcreateListener(Class<T> clazz)voiddispatch()voiddispatch(String path)voiddispatch(javax.servlet.ServletContext context, String path)javax.servlet.ServletRequestgetRequest()javax.servlet.ServletResponsegetResponse()longgetTimeout()voidhandleCompletedBeforeInitialRequestDone()voidhandleError(Throwable error)booleanhasOriginalRequestAndResponse()voidinitialRequestDone()Called by the container when the initial request is finished.booleanisCompletedBeforeInitialRequestDone()booleanisDispatched()voidsetTimeout(long timeout)voidstart(Runnable run)voidupdateTimeout()
-
-
-
Constructor Detail
-
AsyncContextImpl
public AsyncContextImpl(io.undertow.server.HttpServerExchange exchange, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, ServletRequestContext servletRequestContext, boolean requestSupplied, AsyncContextImpl previousAsyncContext)
-
-
Method Detail
-
updateTimeout
public void updateTimeout()
-
getRequest
public javax.servlet.ServletRequest getRequest()
- Specified by:
getRequestin interfacejavax.servlet.AsyncContext
-
getResponse
public javax.servlet.ServletResponse getResponse()
- Specified by:
getResponsein interfacejavax.servlet.AsyncContext
-
hasOriginalRequestAndResponse
public boolean hasOriginalRequestAndResponse()
- Specified by:
hasOriginalRequestAndResponsein interfacejavax.servlet.AsyncContext
-
dispatch
public void dispatch()
- Specified by:
dispatchin interfacejavax.servlet.AsyncContext
-
dispatch
public void dispatch(String path)
- Specified by:
dispatchin interfacejavax.servlet.AsyncContext
-
dispatch
public void dispatch(javax.servlet.ServletContext context, String path)- Specified by:
dispatchin interfacejavax.servlet.AsyncContext
-
complete
public void complete()
- Specified by:
completein interfacejavax.servlet.AsyncContext
-
completeInternal
public void completeInternal(boolean forceComplete)
-
start
public void start(Runnable run)
- Specified by:
startin interfacejavax.servlet.AsyncContext
-
addListener
public void addListener(javax.servlet.AsyncListener listener)
- Specified by:
addListenerin interfacejavax.servlet.AsyncContext
-
addListener
public void addListener(javax.servlet.AsyncListener listener, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)- Specified by:
addListenerin interfacejavax.servlet.AsyncContext
-
isDispatched
public boolean isDispatched()
-
isCompletedBeforeInitialRequestDone
public boolean isCompletedBeforeInitialRequestDone()
-
createListener
public <T extends javax.servlet.AsyncListener> T createListener(Class<T> clazz) throws javax.servlet.ServletException
- Specified by:
createListenerin interfacejavax.servlet.AsyncContext- Throws:
javax.servlet.ServletException
-
setTimeout
public void setTimeout(long timeout)
- Specified by:
setTimeoutin interfacejavax.servlet.AsyncContext
-
getTimeout
public long getTimeout()
- Specified by:
getTimeoutin interfacejavax.servlet.AsyncContext
-
handleError
public void handleError(Throwable error)
-
initialRequestDone
public void initialRequestDone()
Called by the container when the initial request is finished. If this request has a dispatch or complete call pending then this will be started.
-
handleCompletedBeforeInitialRequestDone
public void handleCompletedBeforeInitialRequestDone()
-
addAsyncTask
public void addAsyncTask(Runnable runnable)
Adds a task to be run to the async context. These tasks are run one at a time, after the initial request is finished. If the request is dispatched before the initial request is complete then these tasks will not be runThis method is intended to be used to queue read and write tasks for async streams, to make sure that multiple threads do not end up working on the same exchange at once
- Parameters:
runnable- The runnable
-
-