You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2018/04/23 10:57:26 UTC
svn commit: r1028832 - in /websites/production/cxf/content:
cache/docs.pageCache docs/continuations.html docs/developing-a-consumer.html
Author: buildbot
Date: Mon Apr 23 10:57:25 2018
New Revision: 1028832
Log:
Production update by buildbot for cxf
Modified:
websites/production/cxf/content/cache/docs.pageCache
websites/production/cxf/content/docs/continuations.html
websites/production/cxf/content/docs/developing-a-consumer.html
Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/cxf/content/docs/continuations.html
==============================================================================
--- websites/production/cxf/content/docs/continuations.html (original)
+++ websites/production/cxf/content/docs/continuations.html Mon Apr 23 10:57:25 2018
@@ -117,20 +117,20 @@ Apache CXF -- Continuations
<!-- Content -->
<div class="wiki-content">
<div id="ConfluenceContent"><h1 id="Continuations-Continuations">Continuations</h1><p> </p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1508777307115 {padding: 0px;}
-div.rbtoc1508777307115 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1508777307115 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1524481008563 {padding: 0px;}
+div.rbtoc1524481008563 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1524481008563 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1508777307115">
+/*]]>*/</style></p><div class="toc-macro rbtoc1524481008563">
<ul class="toc-indentation"><li><a shape="rect" href="#Continuations-Continuations">Continuations</a></li><li><a shape="rect" href="#Continuations-ContinuationsAPI">Continuations API</a></li><li><a shape="rect" href="#Continuations-UseAsyncMethod">UseAsyncMethod</a></li><li><a shape="rect" href="#Continuations-JAX-RS2.0AsyncResponse">JAX-RS 2.0 AsyncResponse</a></li><li><a shape="rect" href="#Continuations-SuspendinginvocationsfromCXFinterceptors">Suspending invocations from CXF interceptors</a></li><li><a shape="rect" href="#Continuations-EnablingHTTPcontinuations">Enabling HTTP continuations</a></li></ul>
-</div><h1 id="Continuations-ContinuationsAPI">Continuations API</h1><p>CXF offers Continuations API to manage asynchronous (suspended) invocations.</p><p><a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java">ContinuationProvider</a> represents a transport capable of suspending and resuming the invocations on request.</p><p>CXF offers Servlet3 and legacy Jetty Continuations HTTP as well as JMS ContinuationProvider implementations. <br clear="none"> ContinuationProvider can be used to get <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/Continuation.java">Continuation</a> which represents a current active or suspended invocation.</p><p>The provider and continuations can be obtained from the current CXF message like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeCo
ntent panelContent pdl">
+</div><h1 id="Continuations-ContinuationsAPI">Continuations API</h1><p>CXF offers Continuations API to manage asynchronous (suspended) invocations.</p><p><a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/continuations/ContinuationProvider.java" rel="nofollow">ContinuationProvider</a> represents a transport capable of suspending and resuming the invocations on request.</p><p>CXF offers Servlet3 and legacy Jetty Continuations HTTP as well as JMS ContinuationProvider implementations. <br clear="none"> ContinuationProvider can be used to get <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/continuations/Continuation.java" rel="nofollow">Continuation</a> which represents a current active or suspended invocation.</p><p>The provider and continuations can be obtained from the current CXF message like this:</p><div class="code panel pdl" style="border-w
idth: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">import org.apache.cxf.continuations.ContinuationProvider;
import org.apache.cxf.continuations.Continuation;
ContinuationProvider provider = (ContinuationProvider)message.get(ContinuationProvider.class.getName())
Continuation continuation = provider.getContinuation();
</pre>
-</div></div><p>The continuation can be suspended and resumed.</p><p>Calling Continuation.suspend() and returning from the current method/code is enough to get CXF suspending the request. Additionally throwing <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java">SuspendedInvocationException</a> was required originally but is no longer required/recommended.</p><p>Resuming the continuation will get the suspended thread returning, this is typically done by a thread which has completed an asynchronous task.</p><p>Advanced applications can register <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/core/src/main/java/org/apache/cxf/continuations/ContinuationCallback.java">ContinuationCallback</a> with the current exchange in order to get the notifications that a given Continuation has completed its work by returning the data to the client.<
/p><p>The custom applications can interact directly with Continuations API. CXF also offers higher-level support for asynchronous invocations built on top of Continuations API.</p><h1 id="Continuations-UseAsyncMethod">UseAsyncMethod</h1><p>JAX-WS frontend supports this annotation, please check the <a shape="rect" href="http://cxf.apache.org/docs/annotations.html">CXF Annotations</a> page for more information.</p><h1 id="Continuations-JAX-RS2.0AsyncResponse">JAX-RS 2.0 AsyncResponse</h1><p>JAX-RS 2.0 AsyncResponse is implemented in terms of Continuations API. Please see <a shape="rect" href="http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Suspendedinvocations">this section</a> for more information.</p><h1 id="Continuations-SuspendinginvocationsfromCXFinterceptors">Suspending invocations from CXF interceptors</h1><p>Advanced custom CXF interceptors can suspend the incoming requests and resume them when needed. <br clear="none"> Example:</p><div class="code panel pdl" style=
"border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The continuation can be suspended and resumed.</p><p>Calling Continuation.suspend() and returning from the current method/code is enough to get CXF suspending the request. Additionally throwing <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/continuations/SuspendedInvocationException.java" rel="nofollow">SuspendedInvocationException</a> was required originally but is no longer required/recommended.</p><p>Resuming the continuation will get the suspended thread returning, this is typically done by a thread which has completed an asynchronous task.</p><p>Advanced applications can register <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/core/src/main/java/org/apache/cxf/continuations/ContinuationCallback.java" rel="nofollow">ContinuationCallback</a> with the current exchange in order to get the notifications that a given Continuation has completed its work by retu
rning the data to the client.</p><p>The custom applications can interact directly with Continuations API. CXF also offers higher-level support for asynchronous invocations built on top of Continuations API.</p><h1 id="Continuations-UseAsyncMethod">UseAsyncMethod</h1><p>JAX-WS frontend supports this annotation, please check the <a shape="rect" href="http://cxf.apache.org/docs/annotations.html">CXF Annotations</a> page for more information.</p><h1 id="Continuations-JAX-RS2.0AsyncResponse">JAX-RS 2.0 AsyncResponse</h1><p>JAX-RS 2.0 AsyncResponse is implemented in terms of Continuations API. Please see <a shape="rect" href="http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Suspendedinvocations">this section</a> for more information.</p><h1 id="Continuations-SuspendinginvocationsfromCXFinterceptors">Suspending invocations from CXF interceptors</h1><p>Advanced custom CXF interceptors can suspend the incoming requests and resume them when needed. <br clear="none"> Example:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">//TODO
</pre>
</div></div><h1 id="Continuations-EnablingHTTPcontinuations">Enabling HTTP continuations</h1><p>Make sure CXFServlet is supporting the asynchronous requests, check the <a shape="rect" href="http://cxf.apache.org/docs/servlet-transport.html">Servlet Transport</a> page for more information.</p></div>
Modified: websites/production/cxf/content/docs/developing-a-consumer.html
==============================================================================
--- websites/production/cxf/content/docs/developing-a-consumer.html (original)
+++ websites/production/cxf/content/docs/developing-a-consumer.html Mon Apr 23 10:57:25 2018
@@ -528,12 +528,12 @@ public final class Client {
// Polling approach:
Response<GreetMeSometimeResponse> greetMeSomeTimeResp =
port.greetMeSometimeAsync(System.getProperty("user.name"));
- while (!greetMeSomeTimeResp.isDone()) {
- Thread.sleep(100);
- }
- GreetMeSometimeResponse reply = greetMeSomeTimeResp.get();
- ...
- System.exit(0);
+ while (!greetMeSomeTimeResp.isDone()) {
+ Thread.sleep(100);
+ }
+ GreetMeSometimeResponse reply = greetMeSomeTimeResp.get();
+ ...
+ System.exit(0);
}
}
</pre>
@@ -550,7 +550,7 @@ if (greetMeSomeTimeResp.isDone()) {
GreetMeSometimeResponse reply = greetMeSomeTimeResp.get(
60L,
java.util.concurrent.TimeUnit.SECONDS
- );
+);
</pre>
</div></div></li></ul><h4 id="DevelopingaConsumer-Implementinganasynchronousclientwiththecallbackapproach">Implementing an asynchronous client with the callback approach</h4><p>An alternative approach to making an asynchronous operation invocation is to implement a callback class, by deriving from the<code> javax.xml.ws.AsyncHandler</code> interface. This callback class must implement a <code>handleResponse()</code> method, which is called by the CXF runtime to notify the client that the response has arrived. The following shows an outline of the <code>AsyncHandler</code> interface that you need to implement.</p><p><span class="confluence-anchor-link" id="DevelopingaConsumer-Example10"></span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>The javax.xml.ws.AsyncHandler Interface</b></div><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package javax.xml.ws;