blob: 473ee1d5ad38b00ba509559dd9a4e308eb51a412 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>AsyncContext</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AsyncContext";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../jakarta/servlet/AsyncEvent.html" title="class in jakarta.servlet"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/servlet/AsyncContext.html" target="_top">Frames</a></li>
<li><a href="AsyncContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">jakarta.servlet</div>
<h2 title="Interface AsyncContext" class="title">Interface AsyncContext</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">AsyncContext</span></pre>
<div class="block">Class representing the execution context for an asynchronous operation that was initiated on a ServletRequest.
<p>
An AsyncContext is created and initialized by a call to <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>. Repeated invocations of these methods will return
the same AsyncContext instance, reinitialized as appropriate.
<p>
In the event that an asynchronous operation has timed out, the container must run through these steps:
<ol>
<li>Invoke, at their <a href="../../jakarta/servlet/AsyncListener.html#onTimeout-jakarta.servlet.AsyncEvent-"><code>onTimeout</code></a> method, all <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> instances registered
with the ServletRequest on which the asynchronous operation was initiated.</li>
<li>If none of the listeners called <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> or any of the <a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> methods, perform an error
dispatch with a status code equal to <tt>HttpServletResponse.SC_INTERNAL_SERVER_ERROR</tt>.</li>
<li>If no matching error page was found, or the error page did not call <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> or any of the
<a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> methods, call <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a>.</li>
</ol></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Servlet 3.0</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#ASYNC_CONTEXT_PATH">ASYNC_CONTEXT_PATH</a></span></code>
<div class="block">The name of the request attribute under which the original context path is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#ASYNC_MAPPING">ASYNC_MAPPING</a></span></code>
<div class="block">The name of the request attribute under which the original <a href="../../jakarta/servlet/http/HttpServletMapping.html" title="interface in jakarta.servlet.http"><code>HttpServletMapping</code></a> is made
available to the target of a <a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#ASYNC_PATH_INFO">ASYNC_PATH_INFO</a></span></code>
<div class="block">The name of the request attribute under which the original path info is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#ASYNC_QUERY_STRING">ASYNC_QUERY_STRING</a></span></code>
<div class="block">The name of the request attribute under which the original query string is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#ASYNC_REQUEST_URI">ASYNC_REQUEST_URI</a></span></code>
<div class="block">The name of the request attribute under which the original request URI is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#ASYNC_SERVLET_PATH">ASYNC_SERVLET_PATH</a></span></code>
<div class="block">The name of the request attribute under which the original servlet path is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#addListener-jakarta.servlet.AsyncListener-">addListener</a></span>(<a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet">AsyncListener</a>&nbsp;listener)</code>
<div class="block">Registers the given <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> with the most recent asynchronous cycle that was started by a call to one
of the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#addListener-jakarta.servlet.AsyncListener-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-">addListener</a></span>(<a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet">AsyncListener</a>&nbsp;listener,
<a href="../../jakarta/servlet/ServletRequest.html" title="interface in jakarta.servlet">ServletRequest</a>&nbsp;servletRequest,
<a href="../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a>&nbsp;servletResponse)</code>
<div class="block">Registers the given <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> with the most recent asynchronous cycle that was started by a call to one
of the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#complete--">complete</a></span>()</code>
<div class="block">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.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T extends <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet">AsyncListener</a>&gt;<br>T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#createListener-java.lang.Class-">createListener</a></span>(java.lang.Class&lt;T&gt;&nbsp;clazz)</code>
<div class="block">Instantiates the given <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> class.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#dispatch--">dispatch</a></span>()</code>
<div class="block">Dispatches the request and response objects of this AsyncContext to the servlet container.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-">dispatch</a></span>(<a href="../../jakarta/servlet/ServletContext.html" title="interface in jakarta.servlet">ServletContext</a>&nbsp;context,
java.lang.String&nbsp;path)</code>
<div class="block">Dispatches the request and response objects of this AsyncContext to the given <tt>path</tt> scoped to the given
<tt>context</tt>.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-">dispatch</a></span>(java.lang.String&nbsp;path)</code>
<div class="block">Dispatches the request and response objects of this AsyncContext to the given <tt>path</tt>.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../jakarta/servlet/ServletRequest.html" title="interface in jakarta.servlet">ServletRequest</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#getRequest--">getRequest</a></span>()</code>
<div class="block">Gets the request that was used to initialize this AsyncContext by calling <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#getResponse--">getResponse</a></span>()</code>
<div class="block">Gets the response that was used to initialize this AsyncContext by calling <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#getTimeout--">getTimeout</a></span>()</code>
<div class="block">Gets the timeout (in milliseconds) for this AsyncContext.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#hasOriginalRequestAndResponse--">hasOriginalRequestAndResponse</a></span>()</code>
<div class="block">Checks if this AsyncContext was initialized with the original or application-wrapped request and response objects.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#setTimeout-long-">setTimeout</a></span>(long&nbsp;timeout)</code>
<div class="block">Sets the timeout (in milliseconds) for this AsyncContext.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/servlet/AsyncContext.html#start-java.lang.Runnable-">start</a></span>(java.lang.Runnable&nbsp;run)</code>
<div class="block">Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified
<tt>Runnable</tt>.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="ASYNC_REQUEST_URI">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ASYNC_REQUEST_URI</h4>
<pre>static final&nbsp;java.lang.String ASYNC_REQUEST_URI</pre>
<div class="block">The name of the request attribute under which the original request URI is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.servlet.AsyncContext.ASYNC_REQUEST_URI">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ASYNC_CONTEXT_PATH">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ASYNC_CONTEXT_PATH</h4>
<pre>static final&nbsp;java.lang.String ASYNC_CONTEXT_PATH</pre>
<div class="block">The name of the request attribute under which the original context path is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.servlet.AsyncContext.ASYNC_CONTEXT_PATH">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ASYNC_MAPPING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ASYNC_MAPPING</h4>
<pre>static final&nbsp;java.lang.String ASYNC_MAPPING</pre>
<div class="block">The name of the request attribute under which the original <a href="../../jakarta/servlet/http/HttpServletMapping.html" title="interface in jakarta.servlet.http"><code>HttpServletMapping</code></a> is made
available to the target of a <a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.servlet.AsyncContext.ASYNC_MAPPING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ASYNC_PATH_INFO">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ASYNC_PATH_INFO</h4>
<pre>static final&nbsp;java.lang.String ASYNC_PATH_INFO</pre>
<div class="block">The name of the request attribute under which the original path info is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.servlet.AsyncContext.ASYNC_PATH_INFO">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ASYNC_SERVLET_PATH">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ASYNC_SERVLET_PATH</h4>
<pre>static final&nbsp;java.lang.String ASYNC_SERVLET_PATH</pre>
<div class="block">The name of the request attribute under which the original servlet path is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.servlet.AsyncContext.ASYNC_SERVLET_PATH">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="ASYNC_QUERY_STRING">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ASYNC_QUERY_STRING</h4>
<pre>static final&nbsp;java.lang.String ASYNC_QUERY_STRING</pre>
<div class="block">The name of the request attribute under which the original query string is made available to the target of a
<a href="../../jakarta/servlet/AsyncContext.html#dispatch-java.lang.String-"><code>dispatch(String)</code></a> or <a href="../../jakarta/servlet/AsyncContext.html#dispatch-jakarta.servlet.ServletContext-java.lang.String-"><code>dispatch(ServletContext,String)</code></a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#jakarta.servlet.AsyncContext.ASYNC_QUERY_STRING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getRequest--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRequest</h4>
<pre><a href="../../jakarta/servlet/ServletRequest.html" title="interface in jakarta.servlet">ServletRequest</a>&nbsp;getRequest()</pre>
<div class="block">Gets the request that was used to initialize this AsyncContext by calling <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the request that was used to initialize this AsyncContext</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> or any of the <a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> methods has been called in the
asynchronous cycle</dd>
</dl>
</li>
</ul>
<a name="getResponse--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResponse</h4>
<pre><a href="../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a>&nbsp;getResponse()</pre>
<div class="block">Gets the response that was used to initialize this AsyncContext by calling <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the response that was used to initialize this AsyncContext</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> or any of the <a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> methods has been called in the
asynchronous cycle</dd>
</dl>
</li>
</ul>
<a name="hasOriginalRequestAndResponse--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hasOriginalRequestAndResponse</h4>
<pre>boolean&nbsp;hasOriginalRequestAndResponse()</pre>
<div class="block">Checks if this AsyncContext was initialized with the original or application-wrapped request and response objects.
<p>
This information may be used by filters invoked in the <i>outbound</i> direction, after a request was put into
asynchronous mode, to determine whether any request and/or response wrappers that they added during their
<i>inbound</i> invocation need to be preserved for the duration of the asynchronous operation, or may be released.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if this AsyncContext was initialized with the original request and response objects by calling
<a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a>, or if it was initialized by calling
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>, and neither the ServletRequest nor
ServletResponse arguments carried any application-provided wrappers; false otherwise</dd>
</dl>
</li>
</ul>
<a name="dispatch--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dispatch</h4>
<pre>void&nbsp;dispatch()</pre>
<div class="block">Dispatches the request and response objects of this AsyncContext to the servlet container.
<p>
If the asynchronous cycle was started with <a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>, and
the request passed is an instance of HttpServletRequest, then the dispatch is to the URI returned by
<a href="../../jakarta/servlet/http/HttpServletRequest.html#getRequestURI--"><code>HttpServletRequest.getRequestURI()</code></a>. Otherwise, the dispatch is to the URI of the request
when it was last dispatched by the container.
<p>
The following sequence illustrates how this will work:
<pre>
<code>
// REQUEST dispatch to /url/A
AsyncContext ac = request.startAsync();
...
ac.dispatch(); // ASYNC dispatch to /url/A
// REQUEST to /url/A
// FORWARD dispatch to /url/B
request.getRequestDispatcher("/url/B").forward(request,response);
// Start async operation from within the target of the FORWARD
// dispatch
ac = request.startAsync();
...
ac.dispatch(); // ASYNC dispatch to /url/A
// REQUEST to /url/A
// FORWARD dispatch to /url/B
request.getRequestDispatcher("/url/B").forward(request,response);
// Start async operation from within the target of the FORWARD
// dispatch
ac = request.startAsync(request,response);
...
ac.dispatch(); // ASYNC dispatch to /url/B
</code>
</pre>
<p>
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 before the container-initiated dispatch that
called <tt>startAsync</tt> has returned to the container, the dispatch operation will be delayed until after the
container-initiated dispatch has returned to the container.
<p>
The dispatcher type of the request is set to <tt>DispatcherType.ASYNC</tt>. Unlike
<a href="../../jakarta/servlet/RequestDispatcher.html#forward-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>forward dispatches</code></a>, the response buffer and
headers will not be reset, and it is legal to dispatch even if the response has already been committed.
<p>
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 <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a> are called.
<p>
Any errors or exceptions that may occur during the execution of this method must be caught and handled by the
container, as follows:
<ol>
<li>Invoke, at their <a href="../../jakarta/servlet/AsyncListener.html#onError-jakarta.servlet.AsyncEvent-"><code>onError</code></a> method, all <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> instances registered
with the ServletRequest for which this AsyncContext was created, and make the caught <tt>Throwable</tt> available via
<a href="../../jakarta/servlet/AsyncEvent.html#getThrowable--"><code>AsyncEvent.getThrowable()</code></a>.</li>
<li>If none of the listeners called <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> or any of the <a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> methods, perform an error
dispatch with a status code equal to <tt>HttpServletResponse.SC_INTERNAL_SERVER_ERROR</tt>, and make the above
<tt>Throwable</tt> available as the value of the <tt>RequestDispatcher.ERROR_EXCEPTION</tt> request attribute.</li>
<li>If no matching error page was found, or the error page did not call <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> or any of the
<a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> methods, call <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a>.</li>
</ol>
<p>
There can be at most one asynchronous dispatch operation per asynchronous cycle, which is started by a call to one of
the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods. Any attempt to perform an additional asynchronous dispatch operation
within the same asynchronous cycle will result in an IllegalStateException. If startAsync is subsequently called on
the dispatched request, then any of the dispatch or <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> methods may be called.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if one of the dispatch methods has been called and the startAsync method has not been
called during the resulting dispatch, or if <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> was called</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/servlet/ServletRequest.html#getDispatcherType--"><code>ServletRequest.getDispatcherType()</code></a></dd>
</dl>
</li>
</ul>
<a name="dispatch-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dispatch</h4>
<pre>void&nbsp;dispatch(java.lang.String&nbsp;path)</pre>
<div class="block">Dispatches the request and response objects of this AsyncContext to the given <tt>path</tt>.
<p>
The <tt>path</tt> parameter is interpreted in the same way as in <a href="../../jakarta/servlet/ServletRequest.html#getRequestDispatcher-java.lang.String-"><code>ServletRequest.getRequestDispatcher(String)</code></a>,
within the scope of the <a href="../../jakarta/servlet/ServletContext.html" title="interface in jakarta.servlet"><code>ServletContext</code></a> from which this AsyncContext was initialized.
<p>
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 <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_REQUEST_URI"><code>ASYNC_REQUEST_URI</code></a>,
<a href="../../jakarta/servlet/AsyncContext.html#ASYNC_CONTEXT_PATH"><code>ASYNC_CONTEXT_PATH</code></a>, <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_PATH_INFO"><code>ASYNC_PATH_INFO</code></a>, <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_SERVLET_PATH"><code>ASYNC_SERVLET_PATH</code></a>, and <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_QUERY_STRING"><code>ASYNC_QUERY_STRING</code></a>
attributes of the request. These attributes will always reflect the original path elements, even under repeated
dispatches.
<p>
There can be at most one asynchronous dispatch operation per asynchronous cycle, which is started by a call to one of
the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods. Any attempt to perform an additional asynchronous dispatch operation
within the same asynchronous cycle will result in an IllegalStateException. If startAsync is subsequently called on
the dispatched request, then any of the dispatch or <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> methods may be called.
<p>
See <a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> for additional details, including error handling.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>path</code> - the path of the dispatch target, scoped to the ServletContext from which this AsyncContext was
initialized</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if one of the dispatch methods has been called and the startAsync method has not been
called during the resulting dispatch, or if <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> was called</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/servlet/ServletRequest.html#getDispatcherType--"><code>ServletRequest.getDispatcherType()</code></a></dd>
</dl>
</li>
</ul>
<a name="dispatch-jakarta.servlet.ServletContext-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dispatch</h4>
<pre>void&nbsp;dispatch(<a href="../../jakarta/servlet/ServletContext.html" title="interface in jakarta.servlet">ServletContext</a>&nbsp;context,
java.lang.String&nbsp;path)</pre>
<div class="block">Dispatches the request and response objects of this AsyncContext to the given <tt>path</tt> scoped to the given
<tt>context</tt>.
<p>
The <tt>path</tt> parameter is interpreted in the same way as in <a href="../../jakarta/servlet/ServletRequest.html#getRequestDispatcher-java.lang.String-"><code>ServletRequest.getRequestDispatcher(String)</code></a>,
except that it is scoped to the given <tt>context</tt>.
<p>
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 <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_REQUEST_URI"><code>ASYNC_REQUEST_URI</code></a>,
<a href="../../jakarta/servlet/AsyncContext.html#ASYNC_CONTEXT_PATH"><code>ASYNC_CONTEXT_PATH</code></a>, <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_PATH_INFO"><code>ASYNC_PATH_INFO</code></a>, <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_SERVLET_PATH"><code>ASYNC_SERVLET_PATH</code></a>, and <a href="../../jakarta/servlet/AsyncContext.html#ASYNC_QUERY_STRING"><code>ASYNC_QUERY_STRING</code></a>
attributes of the request. These attributes will always reflect the original path elements, even under repeated
dispatches.
<p>
There can be at most one asynchronous dispatch operation per asynchronous cycle, which is started by a call to one of
the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods. Any attempt to perform an additional asynchronous dispatch operation
within the same asynchronous cycle will result in an IllegalStateException. If startAsync is subsequently called on
the dispatched request, then any of the dispatch or <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> methods may be called.
<p>
See <a href="../../jakarta/servlet/AsyncContext.html#dispatch--"><code>dispatch()</code></a> for additional details, including error handling.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - the ServletContext of the dispatch target</dd>
<dd><code>path</code> - the path of the dispatch target, scoped to the given ServletContext</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if one of the dispatch methods has been called and the startAsync method has not been
called during the resulting dispatch, or if <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> was called</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../jakarta/servlet/ServletRequest.html#getDispatcherType--"><code>ServletRequest.getDispatcherType()</code></a></dd>
</dl>
</li>
</ul>
<a name="complete--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>complete</h4>
<pre>void&nbsp;complete()</pre>
<div class="block">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.
<p>
Any listeners of type <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> that were registered with the ServletRequest for which this AsyncContext
was created will be invoked at their <a href="../../jakarta/servlet/AsyncListener.html#onComplete-jakarta.servlet.AsyncEvent-"><code>onComplete</code></a> method.
<p>
It is legal to call this method any time after a call to <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> or
<a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a>, and before a call to one of the <tt>dispatch</tt>
methods of this class. If this method is called before the container-initiated dispatch that called
<tt>startAsync</tt> has returned to the container, then the call will not take effect (and any invocations of
<a href="../../jakarta/servlet/AsyncListener.html#onComplete-jakarta.servlet.AsyncEvent-"><code>AsyncListener.onComplete(AsyncEvent)</code></a> will be delayed) until after the container-initiated dispatch has
returned to the container.</div>
</li>
</ul>
<a name="start-java.lang.Runnable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>start</h4>
<pre>void&nbsp;start(java.lang.Runnable&nbsp;run)</pre>
<div class="block">Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified
<tt>Runnable</tt>. The container may propagate appropriate contextual information to the <tt>Runnable</tt>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>run</code> - the asynchronous handler</dd>
</dl>
</li>
</ul>
<a name="addListener-jakarta.servlet.AsyncListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addListener</h4>
<pre>void&nbsp;addListener(<a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet">AsyncListener</a>&nbsp;listener)</pre>
<div class="block">Registers the given <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> with the most recent asynchronous cycle that was started by a call to one
of the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods.
<p>
The given AsyncListener will receive an <a href="../../jakarta/servlet/AsyncEvent.html" title="class in jakarta.servlet"><code>AsyncEvent</code></a> when the asynchronous cycle completes successfully, times
out, results in an error, or a new asynchronous cycle is being initiated via one of the
<a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods.
<p>
AsyncListener instances will be notified in the order in which they were added.
<p>
If <a href="../../jakarta/servlet/ServletRequest.html#startAsync-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-"><code>ServletRequest.startAsync(ServletRequest, ServletResponse)</code></a> or <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> is called,
the exact same request and response objects are available from the <a href="../../jakarta/servlet/AsyncEvent.html" title="class in jakarta.servlet"><code>AsyncEvent</code></a> when the <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a>
is notified.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - the AsyncListener to be registered</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called after the container-initiated dispatch, during which one of
the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods was called, has returned to the container</dd>
</dl>
</li>
</ul>
<a name="addListener-jakarta.servlet.AsyncListener-jakarta.servlet.ServletRequest-jakarta.servlet.ServletResponse-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addListener</h4>
<pre>void&nbsp;addListener(<a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet">AsyncListener</a>&nbsp;listener,
<a href="../../jakarta/servlet/ServletRequest.html" title="interface in jakarta.servlet">ServletRequest</a>&nbsp;servletRequest,
<a href="../../jakarta/servlet/ServletResponse.html" title="interface in jakarta.servlet">ServletResponse</a>&nbsp;servletResponse)</pre>
<div class="block">Registers the given <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> with the most recent asynchronous cycle that was started by a call to one
of the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods.
<p>
The given AsyncListener will receive an <a href="../../jakarta/servlet/AsyncEvent.html" title="class in jakarta.servlet"><code>AsyncEvent</code></a> when the asynchronous cycle completes successfully, times
out, results in an error, or a new asynchronous cycle is being initiated via one of the
<a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods.
<p>
AsyncListener instances will be notified in the order in which they were added.
<p>
The given ServletRequest and ServletResponse objects will be made available to the given AsyncListener via the
<a href="../../jakarta/servlet/AsyncEvent.html#getSuppliedRequest--"><code>getSuppliedRequest</code></a> and <a href="../../jakarta/servlet/AsyncEvent.html#getSuppliedResponse--"><code>getSuppliedResponse</code></a> methods, respectively, of the <a href="../../jakarta/servlet/AsyncEvent.html" title="class in jakarta.servlet"><code>AsyncEvent</code></a> delivered to it. These objects should not be
read from or written to, respectively, at the time the AsyncEvent is delivered, because additional wrapping may have
occurred since the given AsyncListener was registered, but may be used in order to release any resources associated
with them.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - the AsyncListener to be registered</dd>
<dd><code>servletRequest</code> - the ServletRequest that will be included in the AsyncEvent</dd>
<dd><code>servletResponse</code> - the ServletResponse that will be included in the AsyncEvent</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called after the container-initiated dispatch, during which one of
the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods was called, has returned to the container</dd>
</dl>
</li>
</ul>
<a name="createListener-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createListener</h4>
<pre>&lt;T extends <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet">AsyncListener</a>&gt;&nbsp;T&nbsp;createListener(java.lang.Class&lt;T&gt;&nbsp;clazz)
throws <a href="../../jakarta/servlet/ServletException.html" title="class in jakarta.servlet">ServletException</a></pre>
<div class="block">Instantiates the given <a href="../../jakarta/servlet/AsyncListener.html" title="interface in jakarta.servlet"><code>AsyncListener</code></a> class.
<p>
The returned AsyncListener instance may be further customized before it is registered with this AsyncContext via a
call to one of the <code>addListener</code> methods.
<p>
The given AsyncListener class must define a zero argument constructor, which is used to instantiate it.
<p>
This method supports resource injection if the given <tt>clazz</tt> represents a Managed Bean. See the Jakarta EE
platform and CDI specifications for additional details about Managed Beans and resource injection.
<p>
This method supports any annotations applicable to AsyncListener.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the class of the object to instantiate</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>clazz</code> - the AsyncListener class to instantiate</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new AsyncListener instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../jakarta/servlet/ServletException.html" title="class in jakarta.servlet">ServletException</a></code> - if the given <tt>clazz</tt> fails to be instantiated</dd>
</dl>
</li>
</ul>
<a name="setTimeout-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTimeout</h4>
<pre>void&nbsp;setTimeout(long&nbsp;timeout)</pre>
<div class="block">Sets the timeout (in milliseconds) for this AsyncContext.
<p>
The timeout applies to this AsyncContext once the container-initiated dispatch during which one of the
<a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods was called has returned to the container.
<p>
The timeout will expire if neither the <a href="../../jakarta/servlet/AsyncContext.html#complete--"><code>complete()</code></a> method nor any of the dispatch methods are called. A timeout
value of zero or less indicates no timeout.
<p>
If <a href="../../jakarta/servlet/AsyncContext.html#setTimeout-long-"><code>setTimeout(long)</code></a> is not called, then the container's default timeout, which is available via a call to
<a href="../../jakarta/servlet/AsyncContext.html#getTimeout--"><code>getTimeout()</code></a>, will apply.
<p>
The default value is <code>30000</code> ms.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>timeout</code> - the timeout in milliseconds</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this method is called after the container-initiated dispatch, during which one of
the <a href="../../jakarta/servlet/ServletRequest.html#startAsync--"><code>ServletRequest.startAsync()</code></a> methods was called, has returned to the container</dd>
</dl>
</li>
</ul>
<a name="getTimeout--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getTimeout</h4>
<pre>long&nbsp;getTimeout()</pre>
<div class="block">Gets the timeout (in milliseconds) for this AsyncContext.
<p>
This method returns the container's default timeout for asynchronous operations, or the timeout value passed to the
most recent invocation of <a href="../../jakarta/servlet/AsyncContext.html#setTimeout-long-"><code>setTimeout(long)</code></a>.
<p>
A timeout value of zero or less indicates no timeout.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the timeout in milliseconds</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../jakarta/servlet/AsyncEvent.html" title="class in jakarta.servlet"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/servlet/AsyncContext.html" target="_top">Frames</a></li>
<li><a href="AsyncContext.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>