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 2013/11/28 12:49:16 UTC

svn commit: r888388 - in /websites/production/cxf/content: cache/docs.pageCache docs/jaxrs-testing.html

Author: buildbot
Date: Thu Nov 28 11:49:16 2013
New Revision: 888388

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jaxrs-testing.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/jaxrs-testing.html
==============================================================================
--- websites/production/cxf/content/docs/jaxrs-testing.html (original)
+++ websites/production/cxf/content/docs/jaxrs-testing.html Thu Nov 28 11:49:16 2013
@@ -231,7 +231,6 @@ public void testGetBookWithProxy() {
 <p>Starting from CXF 2.6.2 it is possible to use CXF Local Transport for testing the JAX-RS endpoints and clients.<br clear="none">
 This avoids the need to start an embedded servlet container and the tests will run faster.</p>
 
-
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 
@@ -314,9 +313,39 @@ public void testAddBookWithProxyDirectDi
 ]]></script>
 </div></div>
 
-<p>Note that setting a LocalConduit.DIRECT_DISPATCH property to 'true' ensures that the invocation goes immediately into the service chain after the client out chain has completed. This works well for all HTTP verbs including GET, POST, etc.</p>
+<p>Note that setting a LocalConduit.DIRECT_DISPATCH property to 'true' ensures that the invocation goes immediately into the service chain after the client out chain has completed. <br clear="none">
+If this property is not set then CXF LocalConduit sets up a pipe which is initiated via an initial write on the client side.</p>
+
+<p>In the above code example Local transport is activated by using a URI "local:" scheme, for example, "local://books". </p>
+
+<p>Alternatively, the address can be set as a relative value such as "/books", with the server and client transportId attribute set to<br clear="none">
+"http://cxf.apache.org/transports/local". In this case, when creating the clients, use JAXRSClientFactoryBean:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
+
+private static void startServer() throws Exception {
+     JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+     sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
+     sf.setAddress("/books");
+     sf.setResourceClasses(MyJaxrsResource.class);
+     server = sf.create();
+}
+
 
-<p>If this property is not set then CXF LocalConduit sets up a pipe which is initiated via an initial write on the client side. Thus this option is only useful for testing POST or PUT invocations</p></div>
+@Test
+    public void testProxyPipedDispatchGet() throws Exception {
+        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+        bean.setTransportId(LocalTransportFactory.TRANSPORT_ID);
+        bean.setAddress("/books");
+        bean.setServiceClass(MyJaxrsResource.class);
+        MyJaxrsResource localProxy = bean.create(MyJaxrsResource.class);
+        Book book = localProxy.getBook("123");
+        assertEquals(123L, book.getId());
+    }
+]]></script>
+</div></div>
+</div>
            </div>
            <!-- Content -->
          </td>