Package io.undertow.servlet.spec
Class AsyncContextImpl
- java.lang.Object
-
- io.undertow.servlet.spec.AsyncContextImpl
-
- All Implemented Interfaces:
jakarta.servlet.AsyncContext
public class AsyncContextImpl extends java.lang.Object implements jakarta.servlet.AsyncContext
- Author:
- Stuart Douglas
-
-
Constructor Summary
Constructors Constructor Description AsyncContextImpl(io.undertow.server.HttpServerExchange exchange, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, ServletRequestContext servletRequestContext, boolean requestSupplied, AsyncContextImpl previousAsyncContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAsyncTask(java.lang.Runnable runnable)
Adds a task to be run to the async context.void
addListener(jakarta.servlet.AsyncListener listener)
void
addListener(jakarta.servlet.AsyncListener listener, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse)
void
complete()
void
completeInternal(boolean forceComplete)
<T extends jakarta.servlet.AsyncListener>
TcreateListener(java.lang.Class<T> clazz)
void
dispatch()
void
dispatch(jakarta.servlet.ServletContext context, java.lang.String path)
void
dispatch(java.lang.String path)
jakarta.servlet.ServletRequest
getRequest()
jakarta.servlet.ServletResponse
getResponse()
long
getTimeout()
void
handleCompletedBeforeInitialRequestDone()
void
handleError(java.lang.Throwable error)
boolean
hasOriginalRequestAndResponse()
void
initialRequestDone()
Called by the container when the initial request is finished.void
initialRequestFailed()
boolean
isCompletedBeforeInitialRequestDone()
boolean
isDispatched()
boolean
isInitialRequestDone()
void
setTimeout(long timeout)
void
start(java.lang.Runnable run)
void
updateTimeout()
-
-
-
Constructor Detail
-
AsyncContextImpl
public AsyncContextImpl(io.undertow.server.HttpServerExchange exchange, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, ServletRequestContext servletRequestContext, boolean requestSupplied, AsyncContextImpl previousAsyncContext)
-
-
Method Detail
-
updateTimeout
public void updateTimeout()
-
getRequest
public jakarta.servlet.ServletRequest getRequest()
- Specified by:
getRequest
in interfacejakarta.servlet.AsyncContext
-
getResponse
public jakarta.servlet.ServletResponse getResponse()
- Specified by:
getResponse
in interfacejakarta.servlet.AsyncContext
-
hasOriginalRequestAndResponse
public boolean hasOriginalRequestAndResponse()
- Specified by:
hasOriginalRequestAndResponse
in interfacejakarta.servlet.AsyncContext
-
isInitialRequestDone
public boolean isInitialRequestDone()
-
dispatch
public void dispatch()
- Specified by:
dispatch
in interfacejakarta.servlet.AsyncContext
-
dispatch
public void dispatch(java.lang.String path)
- Specified by:
dispatch
in interfacejakarta.servlet.AsyncContext
-
dispatch
public void dispatch(jakarta.servlet.ServletContext context, java.lang.String path)
- Specified by:
dispatch
in interfacejakarta.servlet.AsyncContext
-
complete
public void complete()
- Specified by:
complete
in interfacejakarta.servlet.AsyncContext
-
completeInternal
public void completeInternal(boolean forceComplete)
-
start
public void start(java.lang.Runnable run)
- Specified by:
start
in interfacejakarta.servlet.AsyncContext
-
addListener
public void addListener(jakarta.servlet.AsyncListener listener)
- Specified by:
addListener
in interfacejakarta.servlet.AsyncContext
-
addListener
public void addListener(jakarta.servlet.AsyncListener listener, jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse)
- Specified by:
addListener
in interfacejakarta.servlet.AsyncContext
-
isDispatched
public boolean isDispatched()
-
isCompletedBeforeInitialRequestDone
public boolean isCompletedBeforeInitialRequestDone()
-
createListener
public <T extends jakarta.servlet.AsyncListener> T createListener(java.lang.Class<T> clazz) throws jakarta.servlet.ServletException
- Specified by:
createListener
in interfacejakarta.servlet.AsyncContext
- Throws:
jakarta.servlet.ServletException
-
setTimeout
public void setTimeout(long timeout)
- Specified by:
setTimeout
in interfacejakarta.servlet.AsyncContext
-
getTimeout
public long getTimeout()
- Specified by:
getTimeout
in interfacejakarta.servlet.AsyncContext
-
handleError
public void handleError(java.lang.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.
-
initialRequestFailed
public void initialRequestFailed()
-
handleCompletedBeforeInitialRequestDone
public void handleCompletedBeforeInitialRequestDone()
-
addAsyncTask
public void addAsyncTask(java.lang.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
-
-