| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (11.0.2) on Wed Sep 23 17:36:24 GMT 2020 --> |
| <title>AsyncResponse (jakarta.ws.rs-api 3.0.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="dc.created" content="2020-09-23"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="AsyncResponse (jakarta.ws.rs-api 3.0.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"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"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/AsyncResponse.html">Use</a></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" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">jakarta.ws.rs.container</a></div> |
| <h2 title="Interface AsyncResponse" class="title">Interface AsyncResponse</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <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="../HttpMethod.html" title="annotation in jakarta.ws.rs"><code>resource or sub-resource |
| method</code></a> parameter using the <a href="Suspended.html" title="annotation in jakarta.ws.rs.container"><code>@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> |
| @Path("/messages/next") |
| public class MessagingResource { |
| private static final BlockingQueue<AsyncResponse> suspended = new ArrayBlockingQueue<AsyncResponse>(5); |
| |
| @GET |
| public void readMessage(@Suspended AsyncResponse ar) throws InterruptedException { |
| suspended.put(ar); |
| } |
| |
| @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="../WebApplicationException.html" title="class in jakarta.ws.rs"><code>WebApplicationException</code></a> that has |
| <a href="../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="#setTimeoutHandler(jakarta.ws.rs.container.TimeoutHandler)"><code>setting</code></a> |
| a custom <a href="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> |
| <dt><span class="simpleTagLabel">Author:</span></dt> |
| <dd>Marek Potociar</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Field</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#NO_TIMEOUT">NO_TIMEOUT</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">Constant specifying no suspend timeout value.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#cancel()">cancel</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Cancel the suspended request processing.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#cancel(int)">cancel</a></span>​(int retryAfter)</code></th> |
| <td class="colLast"> |
| <div class="block">Cancel the suspended request processing.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#cancel(java.util.Date)">cancel</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util" class="externalLink">Date</a> retryAfter)</code></th> |
| <td class="colLast"> |
| <div class="block">Cancel the suspended request processing.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isCancelled()">isCancelled</a></span>()</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isDone()">isDone</a></span>()</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isSuspended()">isSuspended</a></span>()</code></th> |
| <td class="colLast"> |
| <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><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.lang.Class)">register</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> callback)</code></th> |
| <td class="colLast"> |
| <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><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.lang.Class,java.lang.Class...)">register</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> callback, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>... callbacks)</code></th> |
| <td class="colLast"> |
| <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><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.lang.Object)">register</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> callback)</code></th> |
| <td class="colLast"> |
| <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><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>>></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#register(java.lang.Object,java.lang.Object...)">register</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> callback, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>... callbacks)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#resume(java.lang.Object)">resume</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> response)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#resume(java.lang.Throwable)">resume</a></span>​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a> response)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setTimeout(long,java.util.concurrent.TimeUnit)">setTimeout</a></span>​(long time, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent" class="externalLink">TimeUnit</a> unit)</code></th> |
| <td class="colLast"> |
| <div class="block">Set/update the suspend timeout.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setTimeoutHandler(jakarta.ws.rs.container.TimeoutHandler)">setTimeoutHandler</a></span>​(<a href="TimeoutHandler.html" title="interface in jakarta.ws.rs.container">TimeoutHandler</a> handler)</code></th> |
| <td class="colLast"> |
| <div class="block">Set/replace a time-out handler for the suspended asynchronous response.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a id="NO_TIMEOUT"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>NO_TIMEOUT</h4> |
| <pre>static final 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> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="resume(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>resume</h4> |
| <pre class="methodSignature">boolean resume​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> 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="../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="#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="#isSuspended()"><code>suspended</code></a> and could not be resumed.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#resume(java.lang.Throwable)"><code>resume(Throwable)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="resume(java.lang.Throwable)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>resume</h4> |
| <pre class="methodSignature">boolean resume​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a> 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="../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="#isSuspended()"><code>suspended</code></a> and could not be resumed.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#resume(java.lang.Object)"><code>resume(Object)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="cancel()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>cancel</h4> |
| <pre class="methodSignature">boolean 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="../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="#isSuspended()"><code>suspended</code></a> and could not be cancelled and is not <a href="#isCancelled()"><code>cancelled</code></a> already.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#cancel(int)"><code>cancel(int)</code></a>, |
| <a href="#cancel(java.util.Date)"><code>cancel(java.util.Date)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="cancel(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>cancel</h4> |
| <pre class="methodSignature">boolean cancel​(int 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="../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="#isSuspended()"><code>suspended</code></a> and could not be cancelled and is not <a href="#isCancelled()"><code>cancelled</code></a> already.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#cancel()"><code>cancel()</code></a>, |
| <a href="#cancel(java.util.Date)"><code>cancel(java.util.Date)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="cancel(java.util.Date)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>cancel</h4> |
| <pre class="methodSignature">boolean cancel​(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Date.html?is-external=true" title="class or interface in java.util" class="externalLink">Date</a> 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="../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="#isSuspended()"><code>suspended</code></a> and could not be cancelled and is not <a href="#isCancelled()"><code>cancelled</code></a> already.</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="#cancel()"><code>cancel()</code></a>, |
| <a href="#cancel(int)"><code>cancel(int)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isSuspended()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isSuspended</h4> |
| <pre class="methodSignature">boolean 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="#isCancelled()"><code>isCancelled()</code></a>, |
| <a href="#isDone()"><code>isDone()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isCancelled()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isCancelled</h4> |
| <pre class="methodSignature">boolean 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="#isSuspended()"><code>isSuspended()</code></a>, |
| <a href="#isDone()"><code>isDone()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isDone()"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isDone</h4> |
| <pre class="methodSignature">boolean 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="#isSuspended()"><code>isSuspended()</code></a>, |
| <a href="#isCancelled()"><code>isCancelled()</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setTimeout(long,java.util.concurrent.TimeUnit)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setTimeout</h4> |
| <pre class="methodSignature">boolean setTimeout​(long time, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent" class="externalLink">TimeUnit</a> 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="#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="#isSuspended()"><code>suspended</code></a> state.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setTimeoutHandler(jakarta.ws.rs.container.TimeoutHandler)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setTimeoutHandler</h4> |
| <pre class="methodSignature">void setTimeoutHandler​(<a href="TimeoutHandler.html" title="interface in jakarta.ws.rs.container">TimeoutHandler</a> 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="#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 id="register(java.lang.Class)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>register</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>> register​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> 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><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang" class="externalLink">NullPointerException</a></code> - in case the callback class is <code>null</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="register(java.lang.Class,java.lang.Class...)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>register</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>>> register​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?> callback, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>... 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><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang" class="externalLink">NullPointerException</a></code> - in case any of the callback classes is <code>null</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="register(java.lang.Object)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>register</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>> register​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> 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><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang" class="externalLink">NullPointerException</a></code> - in case the callback instance is <code>null</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="register(java.lang.Object,java.lang.Object...)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>register</h4> |
| <pre class="methodSignature"><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util" class="externalLink">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>,​<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util" class="externalLink">Collection</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink">Class</a><?>>> register​(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a> callback, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a>... 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><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang" class="externalLink">NullPointerException</a></code> - in case any of the callback instances is <code>null</code>.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/AsyncResponse.html">Use</a></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" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.html">All 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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small><p align="left">Copyright © 2018, 2020 Eclipse Foundation.<br>Use is subject to <a href="../../../../resources/EFSL.html" target="_top">license terms</a>.</small></p> |
| </footer> |
| </body> |
| </html> |