Package io.undertow.servlet.spec
Class AsyncContextImpl
java.lang.Object
io.undertow.servlet.spec.AsyncContextImpl
- All Implemented Interfaces:
jakarta.servlet.AsyncContext
- Author:
- Stuart Douglas
-
Field Summary
Fields inherited from interface jakarta.servlet.AsyncContext
ASYNC_CONTEXT_PATH, ASYNC_MAPPING, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH -
Constructor Summary
ConstructorsConstructorDescriptionAsyncContextImpl(HttpServerExchange exchange, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, ServletRequestContext servletRequestContext, boolean requestSupplied, AsyncContextImpl previousAsyncContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAsyncTask(Runnable runnable) Adds a task to be run to the async context.voidaddListener(jakarta.servlet.AsyncListener listener) voidaddListener(jakarta.servlet.AsyncListener listener, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) voidcomplete()voidcompleteInternal(boolean forceComplete) <T extends jakarta.servlet.AsyncListener>
TcreateListener(Class<T> clazz) voiddispatch()voidvoidjakarta.servlet.ServletRequestjakarta.servlet.ServletResponselongvoidvoidhandleError(Throwable error) booleanvoidCalled by the container when the initial request is finished.booleanbooleanvoidsetTimeout(long timeout) voidvoid
-
Constructor Details
-
AsyncContextImpl
public AsyncContextImpl(HttpServerExchange exchange, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, ServletRequestContext servletRequestContext, boolean requestSupplied, AsyncContextImpl previousAsyncContext)
-
-
Method Details
-
updateTimeout
public void updateTimeout() -
getRequest
public jakarta.servlet.ServletRequest getRequest()- Specified by:
getRequestin interfacejakarta.servlet.AsyncContext
-
getResponse
public jakarta.servlet.ServletResponse getResponse()- Specified by:
getResponsein interfacejakarta.servlet.AsyncContext
-
hasOriginalRequestAndResponse
public boolean hasOriginalRequestAndResponse()- Specified by:
hasOriginalRequestAndResponsein interfacejakarta.servlet.AsyncContext
-
dispatch
public void dispatch()- Specified by:
dispatchin interfacejakarta.servlet.AsyncContext
-
dispatch
- Specified by:
dispatchin interfacejakarta.servlet.AsyncContext
-
dispatch
- Specified by:
dispatchin interfacejakarta.servlet.AsyncContext
-
complete
public void complete()- Specified by:
completein interfacejakarta.servlet.AsyncContext
-
completeInternal
public void completeInternal(boolean forceComplete) -
start
- Specified by:
startin interfacejakarta.servlet.AsyncContext
-
addListener
public void addListener(jakarta.servlet.AsyncListener listener) - Specified by:
addListenerin interfacejakarta.servlet.AsyncContext
-
addListener
public void addListener(jakarta.servlet.AsyncListener listener, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) - Specified by:
addListenerin interfacejakarta.servlet.AsyncContext
-
isDispatched
public boolean isDispatched() -
isCompletedBeforeInitialRequestDone
public boolean isCompletedBeforeInitialRequestDone() -
createListener
public <T extends jakarta.servlet.AsyncListener> T createListener(Class<T> clazz) throws jakarta.servlet.ServletException - Specified by:
createListenerin interfacejakarta.servlet.AsyncContext- Throws:
jakarta.servlet.ServletException
-
setTimeout
public void setTimeout(long timeout) - Specified by:
setTimeoutin interfacejakarta.servlet.AsyncContext
-
getTimeout
public long getTimeout()- Specified by:
getTimeoutin interfacejakarta.servlet.AsyncContext
-
handleError
-
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
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
-