| Modifier and Type | Class and Description |
|---|---|
| pack-priv static enum | |
| private static class | AsyncContextImpl.
Class holding all the information required for invoking an AsyncListener (including the AsyncListener itself). |
| private static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final LinkedList | |
| private long | |
| private static final long | |
| private final AtomicBoolean | |
| private final ThreadLocal | |
| private final AtomicBoolean | |
| private boolean | |
| private final ThreadLocal | |
| private boolean | |
| private static final Logger | |
| private final HttpServletRequestImpl | |
| pack-priv static final ExecutorService | |
| private ServletRequest | |
| private ServletResponse | |
| private final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| pack-priv | AsyncContextImpl(HttpServletRequestImpl
the original (unwrapped) request origRequest, ServletRequest the possibly wrapped request passed to ServletRequest.startAsync servletRequest, ServletResponse the possibly wrapped response passed to ServletRequest.startAsync servletResponse, boolean true if the zero-arg version of startAsync was called, false otherwise isStartAsyncWithZeroArg)Constructor |
| Modifier and Type | Method and Description |
|---|---|
| public void | addListener(AsyncListener listener)
Implements jakarta. Registers the given |
| public void | addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse)
Implements jakarta. Registers the given |
| pack-priv void | |
| public void | complete()
Implements jakarta. Completes the asynchronous operation that was started on the request that was used to initialze this AsyncContext, closing the response that was used to initialize this AsyncContext. |
| public <T extends AsyncListener> T | createListener(Class<T> clazz)
Implements jakarta. Instantiates the given |
| public void | dispatch()
Implements jakarta. Dispatches the request and response objects of this AsyncContext to the servlet container. |
| public void | dispatch(String path)
Implements jakarta. Dispatches the request and response objects of this AsyncContext to the given path. |
| public void | dispatch(ServletContext context, String path)
Implements jakarta. Dispatches the request and response objects of this AsyncContext to the given path scoped to the given context. |
| pack-priv boolean | |
| private String | |
| pack-priv HttpServletRequestImpl | |
| public ServletRequest | getRequest()
Implements jakarta. Gets the request that was used to initialize this AsyncContext by calling |
| public ServletResponse | getResponse()
Implements jakarta. Gets the response that was used to initialize this AsyncContext by calling |
| public long | getTimeout()
Implements jakarta. Gets the timeout (in milliseconds) for this AsyncContext. |
| private RequestDispatcher | Returns: the dispatcher of the zero-argument async dispatchDetermines the dispatcher of a zero-argument async dispatch for the given request. |
| public boolean | hasOriginalRequestAndResponse()
Implements jakarta. Checks if this AsyncContext was initialized with the original or application-wrapped request and response objects. |
| private void | init(ServletRequest servletRequest, ServletResponse servletResponse, boolean isStartAsyncWithZeroArg)
|
| pack-priv boolean | |
| pack-priv boolean | isOkToConfigure()
Returns: value true if calls to AsyncContext#addListener and AsyncContext#setTimeout will be accepted, and false if these calls will result in an IllegalStateException |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv void | reinitialize(ServletRequest servletRequest, ServletResponse servletResponse, boolean isStartAsyncWithZeroArg)
|
| pack-priv void | setOkToConfigure(boolean
true if calls to AsyncContext#addListener and AsyncContext#setTimeout will be accepted, and false if
these calls will result in an IllegalStateException value)
|
| public void | setTimeout(long timeout)
Implements jakarta. Sets the timeout (in milliseconds) for this AsyncContext. |
| public void | start(Runnable run)
Implements jakarta. Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified Runnable. |
| asyncListenerContexts | back to summary |
|---|---|
| private final LinkedList<AsyncContextImpl. | |
| asyncTimeoutMillis | back to summary |
|---|---|
| private long asyncTimeoutMillis | |
| DEFAULT_ASYNC_TIMEOUT_MILLIS | back to summary |
|---|---|
| private static final long DEFAULT_ASYNC_TIMEOUT_MILLIS | |
| isDispatchInProgress | back to summary |
|---|---|
| private final AtomicBoolean isDispatchInProgress | |
| isDispatchInScope | back to summary |
|---|---|
| private final ThreadLocal<Boolean> isDispatchInScope | |
| isOkToConfigure | back to summary |
|---|---|
| private final AtomicBoolean isOkToConfigure | |
| isOriginalRequestAndResponse | back to summary |
|---|---|
| private boolean isOriginalRequestAndResponse | |
| isStartAsyncInScope | back to summary |
|---|---|
| private final ThreadLocal<Boolean> isStartAsyncInScope | |
| isStartAsyncWithZeroArg | back to summary |
|---|---|
| private boolean isStartAsyncWithZeroArg | |
| log | back to summary |
|---|---|
| private static final Logger log | |
| origRequest | back to summary |
|---|---|
| private final HttpServletRequestImpl origRequest | |
| pool | back to summary |
|---|---|
| pack-priv static final ExecutorService pool | |
| servletRequest | back to summary |
|---|---|
| private ServletRequest servletRequest | |
| servletResponse | back to summary |
|---|---|
| private ServletResponse servletResponse | |
| startAsyncCounter | back to summary |
|---|---|
| private final AtomicInteger startAsyncCounter | |
| AsyncContextImpl | back to summary |
|---|---|
| pack-priv AsyncContextImpl(HttpServletRequestImpl origRequest, ServletRequest servletRequest, ServletResponse servletResponse, boolean isStartAsyncWithZeroArg) Constructor
| |
| addListener | back to summary |
|---|---|
| public void addListener(AsyncListener listener) Implements jakarta. Doc from jakarta. Registers the given
The given AsyncListener will receive an AsyncListener instances will be notified in the order in which they were added.
If
| |
| addListener | back to summary |
|---|---|
| public void addListener(AsyncListener listener, ServletRequest servletRequest, ServletResponse servletResponse) Implements jakarta. Doc from jakarta. Registers the given
The given AsyncListener will receive an AsyncListener instances will be notified in the order in which they were added.
The given ServletRequest and ServletResponse objects will be made available to the given AsyncListener via the
| |
| clear | back to summary |
|---|---|
| pack-priv void clear() | |
| complete | back to summary |
|---|---|
| public void complete() Implements jakarta. Doc from jakarta. Completes the asynchronous operation that was started on the request that was used to initialze this AsyncContext, closing the response that was used to initialize this AsyncContext.
Any listeners of type
It is legal to call this method any time after a call to
If the output stream is in non-blocking mode when this method is called, the output stream will be closed as
described by
| |
| createListener | back to summary |
|---|---|
| public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException Implements jakarta. Doc from jakarta. Instantiates the given
The returned AsyncListener instance may be further customized before it is registered with this AsyncContext via a
call to one of the The given AsyncListener class must define a zero argument constructor, which is used to instantiate it. This method supports resource injection if the given clazz represents a Managed Bean. See the Jakarta EE platform and CDI specifications for additional details about Managed Beans and resource injection. This method supports any annotations applicable to AsyncListener.
| |
| dispatch | back to summary |
|---|---|
| public void dispatch() Implements jakarta. Doc from jakarta. Dispatches the request and response objects of this AsyncContext to the servlet container.
If the asynchronous cycle was started with The following sequence illustrates how this will work:
This method returns immediately after passing the request and response objects to a container managed thread, on
which the dispatch operation will be performed. If this method is called during a container-initiated dispatch, the
dispatch operation will be delayed until after the container-initiated dispatch has returned to the container.
If the output stream is in non-blocking mode when this method is called, the output stream will be closed as
described by
The dispatcher type of the request is set to DispatcherType.ASYNC. Unlike
Control over the request and response is delegated to the dispatch target, and the response will be closed when the
dispatch target has completed execution, unless Any errors or exceptions that may occur during the execution of this method must be caught and handled by the container, as follows:
There can be at most one asynchronous dispatch operation per asynchronous cycle, which is started by a call to one of
the
| |
| dispatch | back to summary |
|---|---|
| public void dispatch(String path) Implements jakarta. Doc from jakarta. Dispatches the request and response objects of this AsyncContext to the given path.
The path parameter is interpreted in the same way as in
All path related query methods of the request must reflect the dispatch target, while the original request URI,
context path, path info, servlet path, and query string may be recovered from the
There can be at most one asynchronous dispatch operation per asynchronous cycle, which is started by a call to one of
the
See
| |
| dispatch | back to summary |
|---|---|
| public void dispatch(ServletContext context, String path) Implements jakarta. Doc from jakarta. Dispatches the request and response objects of this AsyncContext to the given path scoped to the given context.
The path parameter is interpreted in the same way as in
All path related query methods of the request must reflect the dispatch target, while the original request URI,
context path, path info, servlet path, and query string may be recovered from the
There can be at most one asynchronous dispatch operation per asynchronous cycle, which is started by a call to one of
the
See
| |
| getAndResetDispatchInScope | back to summary |
|---|---|
| pack-priv boolean getAndResetDispatchInScope() | |
| getCombinedPath | back to summary |
|---|---|
| private String getCombinedPath(HttpServletRequest req) | |
| getOriginalRequest | back to summary |
|---|---|
| pack-priv HttpServletRequestImpl getOriginalRequest() | |
| getRequest | back to summary |
|---|---|
| public ServletRequest getRequest() Implements jakarta. Doc from jakarta. Gets the request that was used to initialize this AsyncContext by calling
| |
| getResponse | back to summary |
|---|---|
| public ServletResponse getResponse() Implements jakarta. Doc from jakarta. Gets the response that was used to initialize this AsyncContext by calling
| |
| getTimeout | back to summary |
|---|---|
| public long getTimeout() Implements jakarta. Doc from jakarta. Gets the timeout (in milliseconds) for this AsyncContext.
This method returns the container's default timeout for asynchronous operations, or the timeout value passed to the
most recent invocation of A timeout value of zero or less indicates no timeout.
| |
| getZeroArgDispatcher | back to summary |
|---|---|
| private RequestDispatcher getZeroArgDispatcher(HttpServletRequestImpl origRequest, ServletRequest servletRequest, boolean isStartAsyncWithZeroArg) Determines the dispatcher of a zero-argument async dispatch for the given request.
| |
| hasOriginalRequestAndResponse | back to summary |
|---|---|
| public boolean hasOriginalRequestAndResponse() Implements jakarta. Doc from jakarta. Checks if this AsyncContext was initialized with the original or application-wrapped request and response objects. This information may be used by filters invoked in the outbound direction, after a request was put into asynchronous mode, to determine whether any request and/or response wrappers that they added during their inbound invocation need to be preserved for the duration of the asynchronous operation, or may be released.
| |
| init | back to summary |
|---|---|
| private void init(ServletRequest servletRequest, ServletResponse servletResponse, boolean isStartAsyncWithZeroArg) | |
| isDispatchInScope | back to summary |
|---|---|
| pack-priv boolean isDispatchInScope() | |
| isOkToConfigure | back to summary |
|---|---|
pack-priv boolean isOkToConfigure()
| |
| isStartAsyncInScope | back to summary |
|---|---|
| pack-priv boolean isStartAsyncInScope() | |
| notifyAsyncListeners | back to summary |
|---|---|
| pack-priv void notifyAsyncListeners(AsyncContextImpl. | |
| reinitialize | back to summary |
|---|---|
| pack-priv void reinitialize(ServletRequest servletRequest, ServletResponse servletResponse, boolean isStartAsyncWithZeroArg) | |
| setOkToConfigure | back to summary |
|---|---|
pack-priv void setOkToConfigure(boolean value)
| |
| setTimeout | back to summary |
|---|---|
| public void setTimeout(long timeout) Implements jakarta. Doc from jakarta. Sets the timeout (in milliseconds) for this AsyncContext.
The timeout applies to this AsyncContext once the container-initiated dispatch during which one of the
The timeout will expire if neither the
If
The default value is
| |
| start | back to summary |
|---|---|
| public void start(Runnable run) Implements jakarta. Doc from jakarta. Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified Runnable. The container may propagate appropriate contextual information to the Runnable.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final AsyncContextImpl. | |
| public static final AsyncContextImpl. | |
| public static final AsyncContextImpl. | |
| public static final AsyncContextImpl. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static AsyncContextImpl. | |
| public static AsyncContextImpl. |
| COMPLETE | back to summary |
|---|---|
| public static final AsyncContextImpl. | |
| ERROR | back to summary |
|---|---|
| public static final AsyncContextImpl. | |
| START_ASYNC | back to summary |
|---|---|
| public static final AsyncContextImpl. | |
| TIMEOUT | back to summary |
|---|---|
| public static final AsyncContextImpl. | |
| AsyncEventType | back to summary |
|---|---|
| private AsyncEventType() | |
| valueOf | back to summary |
|---|---|
| public static AsyncContextImpl. | |
| values | back to summary |
|---|---|
| public static AsyncContextImpl. | |
| Modifier and Type | Field and Description |
|---|---|
| private final AsyncListener | |
| private final ServletRequest | |
| private final ServletResponse |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public AsyncListener | |
| public ServletRequest | |
| public ServletResponse |
| listener | back to summary |
|---|---|
| private final AsyncListener listener | |
| request | back to summary |
|---|---|
| private final ServletRequest request | |
| response | back to summary |
|---|---|
| private final ServletResponse response | |
| AsyncListenerContext | back to summary |
|---|---|
| public AsyncListenerContext(AsyncListener listener) | |
| AsyncListenerContext | back to summary |
|---|---|
| public AsyncListenerContext(AsyncListener listener, ServletRequest request, ServletResponse response) | |
| getAsyncListener | back to summary |
|---|---|
| public AsyncListener getAsyncListener() | |
| getRequest | back to summary |
|---|---|
| public ServletRequest getRequest() | |
| getResponse | back to summary |
|---|---|
| public ServletResponse getResponse() | |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private final ThreadFactory |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Thread | newThread(Runnable r)
Implements java. Constructs a new unstarted |
| counter | back to summary |
|---|---|
| private final AtomicInteger counter | |
| defaultFactory | back to summary |
|---|---|
| private final ThreadFactory defaultFactory | |
| AsyncPoolThreadFactory | back to summary |
|---|---|
| private AsyncPoolThreadFactory() | |
| newThread | back to summary |
|---|---|
| public Thread newThread(Runnable r) Implements java. Doc from java. Constructs a new unstarted
| |
| Modifier and Type | Field and Description |
|---|---|
| private final AsyncContextImpl | |
| private final ApplicationDispatcher | |
| private final HttpServletRequestImpl |
| Access | Constructor and Description |
|---|---|
| pack-priv | Handler(AsyncContextImpl asyncContext, ApplicationDispatcher dispatcher, HttpServletRequestImpl origRequest)
|
| Modifier and Type | Method and Description |
|---|---|
| public void |
| asyncContext | back to summary |
|---|---|
| private final AsyncContextImpl asyncContext | |
| dispatcher | back to summary |
|---|---|
| private final ApplicationDispatcher dispatcher | |
| origRequest | back to summary |
|---|---|
| private final HttpServletRequestImpl origRequest | |
| Handler | back to summary |
|---|---|
| pack-priv Handler(AsyncContextImpl asyncContext, ApplicationDispatcher dispatcher, HttpServletRequestImpl origRequest) | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |