blob: c4327fc352a3cb16dd26139725e9b6a998b449d7 [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>AsyncResponse</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="AsyncResponse";
}
}
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,"i13":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/ws/rs/container/CompletionCallback.html" title="interface in jakarta.ws.rs.container"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?jakarta/ws/rs/container/AsyncResponse.html" target="_top">Frames</a></li>
<li><a href="AsyncResponse.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.ws.rs.container</div>
<h2 title="Interface AsyncResponse" class="title">Interface AsyncResponse</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">AsyncResponse</span></pre>
<div class="block">An injectable JAX-RS asynchronous response that provides means for asynchronous server side response processing.
<p>
A new instance of <code>AsyncResponse</code> may be injected into a <a href="../../../../jakarta/ws/rs/HttpMethod.html" title="annotation in jakarta.ws.rs"><code>resource or sub-resource
method</code></a> parameter using the <a href="../../../../jakarta/ws/rs/container/Suspended.html" title="annotation in jakarta.ws.rs.container"><code>&#64;Suspended</code></a> annotation.
</p>
Each asynchronous response instance is bound to the running request and can be used to asynchronously provide the
request processing result or otherwise manipulate the suspended client connection. The available operations include:
<ul>
<li>updating suspended state data (time-out value, response ...)</li>
<li>resuming the suspended request processing</li>
<li>canceling the suspended request processing</li>
</ul>
<p>
Following example demonstrates the use of the <code>AsyncResponse</code> for asynchronous HTTP request processing:
</p>
<pre>
&#64;Path("/messages/next")
public class MessagingResource {
private static final BlockingQueue&lt;AsyncResponse&gt; suspended = new ArrayBlockingQueue&lt;AsyncResponse&gt;(5);
&#64;GET
public void readMessage(&#64;Suspended AsyncResponse ar) throws InterruptedException {
suspended.put(ar);
}
&#64;POST
public String postMessage(final String message) throws InterruptedException {
final AsyncResponse ar = suspended.take();
ar.resume(message); // resumes the processing of one GET request
return "Message sent";
}
}
</pre>
<p>
If the asynchronous response was suspended with a positive timeout value, and has not been explicitly resumed before
the timeout has expired, the processing will be resumed once the specified timeout threshold is reached, provided a
positive timeout value was set on the response.
</p>
<p>
By default a timed-out asynchronous response is resumed with a <a href="../../../../jakarta/ws/rs/WebApplicationException.html" title="class in jakarta.ws.rs"><code>WebApplicationException</code></a> that has
<a href="../../../../jakarta/ws/rs/core/Response.Status.html#SERVICE_UNAVAILABLE"><code>HTTP 503 (Service unavailable)</code></a> error response status
code set. This default behavior may be overridden by <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#setTimeoutHandler-jakarta.ws.rs.container.TimeoutHandler-"><code>setting</code></a>
a custom <a href="../../../../jakarta/ws/rs/container/TimeoutHandler.html" title="interface in jakarta.ws.rs.container"><code>time-out handler</code></a>.
</p></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.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 long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#NO_TIMEOUT">NO_TIMEOUT</a></span></code>
<div class="block">Constant specifying no suspend timeout value.</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>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel--">cancel</a></span>()</code>
<div class="block">Cancel the suspended request processing.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel-java.util.Date-">cancel</a></span>(java.util.Date&nbsp;retryAfter)</code>
<div class="block">Cancel the suspended request processing.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel-int-">cancel</a></span>(int&nbsp;retryAfter)</code>
<div class="block">Cancel the suspended request processing.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isCancelled--">isCancelled</a></span>()</code>
<div class="block">Check if the asynchronous response instance has been cancelled.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isDone--">isDone</a></span>()</code>
<div class="block">Check if the processing of a request this asynchronous response instance belongs to has finished.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--">isSuspended</a></span>()</code>
<div class="block">Check if the asynchronous response instance is in a suspended state.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#register-java.lang.Class-">register</a></span>(java.lang.Class&lt;?&gt;&nbsp;callback)</code>
<div class="block">Register an asynchronous processing lifecycle callback class to receive lifecycle events for the asynchronous
response based on the implemented callback interfaces.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.Class&lt;?&gt;,java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#register-java.lang.Class-java.lang.Class...-">register</a></span>(java.lang.Class&lt;?&gt;&nbsp;callback,
java.lang.Class&lt;?&gt;...&nbsp;callbacks)</code>
<div class="block">Register asynchronous processing lifecycle callback classes to receive lifecycle events for the asynchronous response
based on the implemented callback interfaces.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#register-java.lang.Object-">register</a></span>(java.lang.Object&nbsp;callback)</code>
<div class="block">Register an asynchronous processing lifecycle callback instance to receive lifecycle events for the asynchronous
response based on the implemented callback interfaces.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.Class&lt;?&gt;,java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#register-java.lang.Object-java.lang.Object...-">register</a></span>(java.lang.Object&nbsp;callback,
java.lang.Object...&nbsp;callbacks)</code>
<div class="block">Register an asynchronous processing lifecycle callback instances to receive lifecycle events for the asynchronous
response based on the implemented callback interfaces.</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/ws/rs/container/AsyncResponse.html#resume-java.lang.Object-">resume</a></span>(java.lang.Object&nbsp;response)</code>
<div class="block">Resume the suspended request processing using the provided response data.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#resume-java.lang.Throwable-">resume</a></span>(java.lang.Throwable&nbsp;response)</code>
<div class="block">Resume the suspended request processing using the provided throwable.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#setTimeout-long-java.util.concurrent.TimeUnit-">setTimeout</a></span>(long&nbsp;time,
java.util.concurrent.TimeUnit&nbsp;unit)</code>
<div class="block">Set/update the suspend timeout.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#setTimeoutHandler-jakarta.ws.rs.container.TimeoutHandler-">setTimeoutHandler</a></span>(<a href="../../../../jakarta/ws/rs/container/TimeoutHandler.html" title="interface in jakarta.ws.rs.container">TimeoutHandler</a>&nbsp;handler)</code>
<div class="block">Set/replace a time-out handler for the suspended asynchronous response.</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="NO_TIMEOUT">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>NO_TIMEOUT</h4>
<pre>static final&nbsp;long NO_TIMEOUT</pre>
<div class="block">Constant specifying no suspend timeout value.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#jakarta.ws.rs.container.AsyncResponse.NO_TIMEOUT">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="resume-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resume</h4>
<pre>boolean&nbsp;resume(java.lang.Object&nbsp;response)</pre>
<div class="block">Resume the suspended request processing using the provided response data.
The provided response data can be of any Java type that can be returned from a <a href="../../../../jakarta/ws/rs/HttpMethod.html" title="annotation in jakarta.ws.rs"><code>JAX-RS
resource method</code></a>.
<p>
The asynchronous response must be still in a <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> state for this method to succeed.
</p>
<p>
By executing this method, the request is guaranteed to complete either successfully or with an error. The data
processing by the JAX-RS runtime follows the same path as it would for the response data returned synchronously by a
JAX-RS resource, except that unmapped exceptions are not re-thrown by JAX-RS runtime to be handled by a hosting I/O
container. Instead, any unmapped exceptions are propagated to the hosting I/O container via a container-specific
callback mechanism. Depending on the container implementation, propagated unmapped exceptions typically result in an
error status being sent to the client and/or the connection being closed.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>response</code> - data to be sent back in response to the suspended request.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the request processing has been resumed, returns <code>false</code> in case the request processing
is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> and could not be resumed.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#resume-java.lang.Throwable-"><code>resume(Throwable)</code></a></dd>
</dl>
</li>
</ul>
<a name="resume-java.lang.Throwable-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resume</h4>
<pre>boolean&nbsp;resume(java.lang.Throwable&nbsp;response)</pre>
<div class="block">Resume the suspended request processing using the provided throwable.
For the provided throwable same rules apply as for an exception thrown by a <a href="../../../../jakarta/ws/rs/HttpMethod.html" title="annotation in jakarta.ws.rs"><code>JAX-RS
resource method</code></a>.
<p>
By executing this method, the request is guaranteed to complete either successfully or with an error. The throwable
processing by the JAX-RS runtime follows the same path as it would for the response data returned synchronously by a
JAX-RS resource, except that unmapped exceptions are not re-thrown by JAX-RS runtime to be handled by a hosting I/O
container. Instead, any unmapped exceptions are propagated to the hosting I/O container via a container-specific
callback mechanism. Depending on the container implementation, propagated unmapped exceptions typically result in an
error status being sent to the client and/or the connection being closed.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>response</code> - an exception to be raised in response to the suspended request.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the response has been resumed, returns <code>false</code> in case the response is not
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> and could not be resumed.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#resume-java.lang.Object-"><code>resume(Object)</code></a></dd>
</dl>
</li>
</ul>
<a name="cancel--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cancel</h4>
<pre>boolean&nbsp;cancel()</pre>
<div class="block">Cancel the suspended request processing.
<p>
When a request processing is cancelled using this method, the JAX-RS implementation MUST indicate to the client that
the request processing has been cancelled by sending back a
<a href="../../../../jakarta/ws/rs/core/Response.Status.html#SERVICE_UNAVAILABLE"><code>HTTP 503 (Service unavailable)</code></a> error response.
</p>
<p>
Invoking a <code>cancel(...)</code> method multiple times to cancel request processing has the same effect as canceling
the request processing only once. Invoking a <code>cancel(...)</code> method on an asynchronous response instance that has
already been cancelled or resumed has no effect and the method call is ignored while returning <code>true</code>, in case
the request has been cancelled previously. Otherwise, in case the request has been resumed regularly (using a
<code>resume(...) method</code>) or resumed due to a time-out, method returns <code>false</code>.
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the request processing has been cancelled, returns <code>false</code> in case the request
processing is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> and could not be cancelled and is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isCancelled--"><code>cancelled</code></a> already.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel-int-"><code>cancel(int)</code></a>,
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel-java.util.Date-"><code>cancel(java.util.Date)</code></a></dd>
</dl>
</li>
</ul>
<a name="cancel-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cancel</h4>
<pre>boolean&nbsp;cancel(int&nbsp;retryAfter)</pre>
<div class="block">Cancel the suspended request processing.
<p>
When a request processing is cancelled using this method, the JAX-RS implementation MUST indicate to the client that
the request processing has been cancelled by sending back a
<a href="../../../../jakarta/ws/rs/core/Response.Status.html#SERVICE_UNAVAILABLE"><code>HTTP 503 (Service unavailable)</code></a> error response with a
<code>Retry-After</code> header set to the value provided by the method parameter.
</p>
<p>
Invoking a <code>cancel(...)</code> method multiple times to cancel request processing has the same effect as canceling
the request processing only once. Invoking a <code>cancel(...)</code> method on an asynchronous response instance that has
already been cancelled or resumed has no effect and the method call is ignored while returning <code>true</code>, in case
the request has been cancelled previously. Otherwise, in case the request has been resumed regularly (using a
<code>resume(...) method</code>) or resumed due to a time-out, method returns <code>false</code>.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>retryAfter</code> - a decimal integer number of seconds after the response is sent to the client that indicates how
long the service is expected to be unavailable to the requesting client.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the request processing has been cancelled, returns <code>false</code> in case the request
processing is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> and could not be cancelled and is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isCancelled--"><code>cancelled</code></a> already.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel--"><code>cancel()</code></a>,
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel-java.util.Date-"><code>cancel(java.util.Date)</code></a></dd>
</dl>
</li>
</ul>
<a name="cancel-java.util.Date-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cancel</h4>
<pre>boolean&nbsp;cancel(java.util.Date&nbsp;retryAfter)</pre>
<div class="block">Cancel the suspended request processing.
<p>
When a request processing is cancelled using this method, the JAX-RS implementation MUST indicate to the client that
the request processing has been cancelled by sending back a
<a href="../../../../jakarta/ws/rs/core/Response.Status.html#SERVICE_UNAVAILABLE"><code>HTTP 503 (Service unavailable)</code></a> error response with a
<code>Retry-After</code> header set to the value provided by the method parameter.
</p>
<p>
Invoking a <code>cancel(...)</code> method multiple times to cancel request processing has the same effect as canceling
the request processing only once. Invoking a <code>cancel(...)</code> method on an asynchronous response instance that has
already been cancelled or resumed has no effect and the method call is ignored while returning <code>true</code>, in case
the request has been cancelled previously. Otherwise, in case the request has been resumed regularly (using a
<code>resume(...) method</code>) or resumed due to a time-out, method returns <code>false</code>.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>retryAfter</code> - a date that indicates how long the service is expected to be unavailable to the requesting client.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the request processing has been cancelled, returns <code>false</code> in case the request
processing is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> and could not be cancelled and is not <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isCancelled--"><code>cancelled</code></a> already.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel--"><code>cancel()</code></a>,
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#cancel-int-"><code>cancel(int)</code></a></dd>
</dl>
</li>
</ul>
<a name="isSuspended--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSuspended</h4>
<pre>boolean&nbsp;isSuspended()</pre>
<div class="block">Check if the asynchronous response instance is in a suspended state.
Method returns <code>true</code> if this asynchronous response is still suspended and has not finished processing yet
(either by resuming or canceling the response).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if this asynchronous response is in a suspend state, <code>false</code> otherwise.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isCancelled--"><code>isCancelled()</code></a>,
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isDone--"><code>isDone()</code></a></dd>
</dl>
</li>
</ul>
<a name="isCancelled--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isCancelled</h4>
<pre>boolean&nbsp;isCancelled()</pre>
<div class="block">Check if the asynchronous response instance has been cancelled.
Method returns <code>true</code> if this asynchronous response has been canceled before completion.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if this task was canceled before completion.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>isSuspended()</code></a>,
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isDone--"><code>isDone()</code></a></dd>
</dl>
</li>
</ul>
<a name="isDone--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isDone</h4>
<pre>boolean&nbsp;isDone()</pre>
<div class="block">Check if the processing of a request this asynchronous response instance belongs to has finished.
Method returns <code>true</code> if the processing of a request this asynchronous response is bound to is finished.
<p>
The request processing may be finished due to a normal termination, a suspend timeout, or cancellation -- in all of
these cases, this method will return <code>true</code>.
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if this execution context has finished processing.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>isSuspended()</code></a>,
<a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isCancelled--"><code>isCancelled()</code></a></dd>
</dl>
</li>
</ul>
<a name="setTimeout-long-java.util.concurrent.TimeUnit-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTimeout</h4>
<pre>boolean&nbsp;setTimeout(long&nbsp;time,
java.util.concurrent.TimeUnit&nbsp;unit)</pre>
<div class="block">Set/update the suspend timeout.
<p>
The new suspend timeout values override any timeout value previously specified. The asynchronous response must be
still in a <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> state for this method to succeed.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>time</code> - suspend timeout value in the give time <code>unit</code>. Value lower or equal to 0 causes the context to
suspend indefinitely.</dd>
<dd><code>unit</code> - suspend timeout value time unit.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the suspend time out has been set, returns <code>false</code> in case the request processing is
not in the <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#isSuspended--"><code>suspended</code></a> state.</dd>
</dl>
</li>
</ul>
<a name="setTimeoutHandler-jakarta.ws.rs.container.TimeoutHandler-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTimeoutHandler</h4>
<pre>void&nbsp;setTimeoutHandler(<a href="../../../../jakarta/ws/rs/container/TimeoutHandler.html" title="interface in jakarta.ws.rs.container">TimeoutHandler</a>&nbsp;handler)</pre>
<div class="block">Set/replace a time-out handler for the suspended asynchronous response.
<p>
The time-out handler will be invoked when the suspend period of this asynchronous response times out. The job of the
time-out handler is to resolve the time-out situation by either
</p>
<ul>
<li>resuming the suspended response</li>
<li>cancelling the suspended response</li>
<li>extending the suspend period by setting a new suspend time-out</li>
</ul>
<p>
Note that in case the response is suspended <a href="../../../../jakarta/ws/rs/container/AsyncResponse.html#NO_TIMEOUT"><code>indefinitely</code></a>, the time-out handler may never be
invoked.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>handler</code> - response time-out handler.</dd>
</dl>
</li>
</ul>
<a name="register-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre>java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;&nbsp;register(java.lang.Class&lt;?&gt;&nbsp;callback)</pre>
<div class="block">Register an asynchronous processing lifecycle callback class to receive lifecycle events for the asynchronous
response based on the implemented callback interfaces.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>callback</code> - callback class.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>collection of registered callback interfaces. If the callback class does not implement any recognized
callback interfaces, the returned collection will be empty.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - in case the callback class is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a name="register-java.lang.Class-java.lang.Class...-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre>java.util.Map&lt;java.lang.Class&lt;?&gt;,java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;&gt;&nbsp;register(java.lang.Class&lt;?&gt;&nbsp;callback,
java.lang.Class&lt;?&gt;...&nbsp;callbacks)</pre>
<div class="block">Register asynchronous processing lifecycle callback classes to receive lifecycle events for the asynchronous response
based on the implemented callback interfaces.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>callback</code> - callback class.</dd>
<dd><code>callbacks</code> - additional callback classes.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>map of registered classes and the callback interfaces registered for each class. If a callback class does not
implement any recognized callback interfaces, the associated collection of registered interfaces for the class will
be empty.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - in case any of the callback classes is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a name="register-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>register</h4>
<pre>java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;&nbsp;register(java.lang.Object&nbsp;callback)</pre>
<div class="block">Register an asynchronous processing lifecycle callback instance to receive lifecycle events for the asynchronous
response based on the implemented callback interfaces.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>callback</code> - callback instance implementing one or more of the recognized callback interfaces.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>collection of registered callback interfaces. If the callback class does not implement any recognized
callback interfaces, the returned collection will be empty.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - in case the callback instance is <code>null</code>.</dd>
</dl>
</li>
</ul>
<a name="register-java.lang.Object-java.lang.Object...-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>register</h4>
<pre>java.util.Map&lt;java.lang.Class&lt;?&gt;,java.util.Collection&lt;java.lang.Class&lt;?&gt;&gt;&gt;&nbsp;register(java.lang.Object&nbsp;callback,
java.lang.Object...&nbsp;callbacks)</pre>
<div class="block">Register an asynchronous processing lifecycle callback instances to receive lifecycle events for the asynchronous
response based on the implemented callback interfaces.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>callback</code> - callback instance.</dd>
<dd><code>callbacks</code> - additional callback instances.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>map of registered classes and the callback interfaces registered for each class. If a callback class does not
implement any recognized callback interfaces, the associated collection of registered interfaces for the class will
be empty.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - in case any of the callback instances is <code>null</code>.</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/ws/rs/container/CompletionCallback.html" title="interface in jakarta.ws.rs.container"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?jakarta/ws/rs/container/AsyncResponse.html" target="_top">Frames</a></li>
<li><a href="AsyncResponse.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>