cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1018074 [11/31] - in /websites/production/cxf/content: ./ 2008/04/28/ 2008/06/20/ 2008/10/23/ 2009/02/10/ 2009/08/04/ cache/ docs/
Date Tue, 12 Sep 2017 19:09:50 GMT
Modified: websites/production/cxf/content/docs/jax-rs-advanced-features.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-advanced-features.html (original)
+++ websites/production/cxf/content/docs/jax-rs-advanced-features.html Tue Sep 12 19:09:41 2017
@@ -32,8 +32,8 @@
 <link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
 
 <script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script>
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -117,26 +117,29 @@ Apache CXF -- JAX-RS Advanced Features
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;<span class="inline-first-p" style="font-size:2em;font-weight:bold">JAX-RS : Advanced Features</span>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1456742825671 {padding: 0px;}
-div.rbtoc1456742825671 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1456742825671 li {margin-left: 0px;padding-left: 0px;}
+<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;<span style="font-size:2em;font-weight:bold">JAX-RS : Advanced Features</span>
+
+
+&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
+div.rbtoc1505243004096 {padding: 0px;}
+div.rbtoc1505243004096 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505243004096 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1456742825671">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505243004096">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSAdvancedFeatures-JMSSupport">JMS Support</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSAdvancedFeatures-Endpoints">Endpoints</a></li><li><a shape="rect" href="#JAX-RSAdvancedFeatures-Client">Client</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSAdvancedFeatures-AdvancedSearch">Advanced Search</a></li><li><a shape="rect" href="#JAX-RSAdvancedFeatures-Onewayinvocations">Oneway invocations</a></li><li><a shape="rect" href="#JAX-RSAdvancedFeatures-SupportforContinuations">Support for Continuations</a></li><li><a shape="rect" href="#JAX-RSAdvancedFeatures-Server-sidecaching">Server-side caching</a></li><li><a shape="rect" href="#JAX-RSAdvancedFeatures-RESTfulserviceswithoutannotations">RESTful services without annotations</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSAdvancedFeatures-Configuration">Configuration</a></li></ul>
 </li></ul>
 </div><h1 id="JAX-RSAdvancedFeatures-JMSSupport">JMS Support</h1><p>CXF has been designed such that multiple transports can be supported for a given endpoint. CXF JAX-RS endpoint and proxies can optionally <br clear="none"> support the JMS transport.</p><h2 id="JAX-RSAdvancedFeatures-Endpoints">Endpoints</h2><p>If you would like your JAXRS endpoint be capable of serving not only HTTP but also JMS requests then you need to specify a JMS transportId, example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;jaxrs:server serviceName="s:BookService" transportId="http://cxf.apache.org/transports/jms" address="/"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;jaxrs:server serviceName="s:BookService" transportId="http://cxf.apache.org/transports/jms" address="/"&gt;
  &lt;jaxrs:serviceBeans&gt;
    &lt;bean class="org.apache.cxf.systest.jaxrs.JMSBookStore"/&gt;
  &lt;/jaxrs:serviceBeans&gt;
 &lt;/jaxrs:server&gt;
 </pre>
 </div></div><p>Additionally, JMS queue or topic <a shape="rect" href="http://cxf.apache.org/docs/using-the-jmsconfigfeature.html">configuration</a> needs to be done, for example, please see this <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/jms_server_config.xml">beans.xml</a>. Please note how a serviceName attribute is used to specify a service QName for a jaxrs endpoint (default is {<a shape="rect" class="external-link" href="http://reverse.package.name" rel="nofollow">http://reverse.package.name</a>}ServiceClassName), this service name is <br clear="none"> used to configure a jms destination.</p><p>Here is the actual <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java">test</a>.</p><p>Here are JMS properties which can help with matching a required method on the JAXRS endp
 oint :</p><ul class="alternate"><li>"Content-Type" : default is "text/xml"</li><li>"Accept" : default is "<strong>/</strong>"</li><li>"OnewayMessage" : default is "false"</li><li>"org.apache.cxf.message.Message.REQUEST_URI" : default is "/"</li><li>"org.apache.cxf.message.Message.HTTP_REQUEST_METHOD" : default is "POST"</li></ul><p>If JMS messages are sent to topic destinations then one has to either set a "OnewayMessage" property or ensure that target JAXRS methods are annotated with org.apache.cxf.jaxrs.ext.Oneway.</p><p>As far as REQUEST_URI is concerned, it is initially matched against a jaxrs:server/@address. So if REQUEST_URI is not set or set to "/" then jaxrs:server/@address has to be set to "/". If REQUEST_URI is set to "/bar/foo" and<br clear="none"> jaxrs:server/@address is set to "/bar" then it will be '/foo' which will be used to find a root resource class and its method.</p><p>By referencing a bean such as 'org.apache.cxf.systest.jaxrs.JMSBookStore' from multiple jaxrs
  endpoints you can ensure that both HTTP and JMS requests are handled by the same service bean. In such cases you may want to use a CXF JAXRS specific <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ProtocolHeaders.java">ProtocolHeaders</a> context which will let you get either HTTP or JMS headers.</p><h2 id="JAX-RSAdvancedFeatures-Client">Client</h2><p>Starting from CXF 2.5.5 and CXF 2.6.2 it is possible to use the client proxies to invoke on JMS endpoints. All one needs to do is to provide a JMS endpoint address and then continue working with the proxy as usual. For 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;">// setup the the client
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">// setup the the client
 String endpointAddressUrlEncoded = "jms:jndi:dynamicQueues/test.jmstransport.text"
              + "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
              + "&amp;replyToName=dynamicQueues/test.jmstransport.response"
@@ -149,7 +152,7 @@ assertEquals("Get a wrong response code.
 assertEquals("Get a wrong book id.", 123, book.getId());
 </pre>
 </div></div><p>The client runtime will set up the JMS properties described in the previous section according to JAX-RS and other annotations (such as org.apache.cxf.jaxrs.ext.Oneway) available in JMSBookStore resource class.</p><h1 id="JAX-RSAdvancedFeatures-AdvancedSearch">Advanced Search</h1><p>Please see <a shape="rect" href="jax-rs-search.html">JAX-RS Search</a> for more information</p><h1 id="JAX-RSAdvancedFeatures-Onewayinvocations">Oneway invocations</h1><p>Resource methods with an org.apache.cxf.jaxrs.ext.Oneway annotation will be invoked oneway with the original request returning 202 HTTP status. HTTP or JMS clients can also add a "OnewayRequest" header if adding Oneway annotations is not an option.</p><h1 id="JAX-RSAdvancedFeatures-SupportforContinuations">Support for Continuations</h1><p>Please see <a shape="rect" class="external-link" href="http://sberyozkin.blogspot.com/2008/12/continuations-in-cxf.html" rel="nofollow">this blog entry</a> describing how JAXRS (and indee
 d) JAXWS services can rely on the CXF Continuations API.</p><p>Please see the <a shape="rect" href="continuations.html">Continuations</a> page for more information.</p><h1 id="JAX-RSAdvancedFeatures-Server-sidecaching">Server-side caching</h1><p><a shape="rect" class="external-link" href="http://ehcache.org/documentation/web_caching.html" rel="nofollow">Ehcache-Web</a> and other similar frameworks can be used to provide an advanced support for<br clear="none"> the server-side caching.</p><p>For example, the only thing you need to do to interpose Ehcache-Web on top of CXF JAX-RS endpoints is to add the following declarations to the web.xml, assuming the name of the war is 'ehcache-cxf':</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;context-param&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;context-param&gt;
         &lt;param-name&gt;webAppRootKey&lt;/param-name&gt;
         &lt;param-value&gt;ehcache-cxf&lt;/param-value&gt;
     &lt;/context-param&gt;
@@ -168,7 +171,7 @@ assertEquals("Get a wrong book id.", 123
     &lt;/filter-mapping&gt;
 </pre>
 </div></div><p>Please see the <a shape="rect" class="external-link" href="http://ehcache.org/documentation/web_caching.html" rel="nofollow">Ehcache-Web</a> page for more information on how to configure it, here is one example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../main/config/ehcache.xsd"
     updateCheck="false"
     monitoring="autodetect"
@@ -191,7 +194,7 @@ assertEquals("Get a wrong book id.", 123
 &lt;/ehcache&gt;
 </pre>
 </div></div><p>This configuration has to be saved in ehcache-web.xml file and available as a class-path resource starting from the root.</p><h1 id="JAX-RSAdvancedFeatures-RESTfulserviceswithoutannotations">RESTful services without annotations</h1><p>One of the latest CXF JAX-RS extensions allows users to provide external models with the information which the runtime typically gets from JAX-RS annotations like @Path, @PathParam, @Consumes, @Produces, etc.<br clear="none"> There might be a number of cases when it can be advantageous to describe how a given resource can be exposed as a RESTful service without actually modifying this resource. For example, when new dynamic interface implementations are registered, when no source code can be modified, when the cost of future updates (for ex, modifying the value of @Path annotations) is considered to be expensive, etc.</p><p>User model schema type is described in the <a shape="rect" class="external-link" href="http://svn.apache.org/repos/
 asf/cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs-common.xsd">jaxrs.xsd</a>.</p><p>The top-level 'model' element can have 'resource' children elements. A 'resource' element describes a resource class which can be either a root resource class or a sub-resource one and it can have attributes describing 'path', 'produces' and 'consumes' values and it has a 'name' attribute which identifies a fully-qualified resource class. <br clear="none"> A 'resource' element can have a number of 'operation' elements pointing to resource methods (with its 'name' attribute) and can have 'path', 'produces', 'consumes' and 'verb' (HTTP method) values. An 'operation' element which has no 'verb' attribute is treated as a sub-resource locator - a corresponding resource class has to be available in the model with its 'name' attribute matching the return type's name of this operation.<br clear="none"> Every operation can have a number of 'param' elements. A 'param' element should have its 'nam
 e' attribute matching a corresponding parameter name in the class resource method. Its 'type' can have the following values : 'PATH', 'QUERY', 'CONTEXT', 'HEADER', 'MATRIX', 'COOKIE', 'FORM' or 'REQUEST_BODY'. Parameters corresponding to response types do not have to be described. It can also have 'defaultValue' and 'encoded' values being set.</p><p>Starting from CXF 2.3.2-SNAPSHOT a "oneway" attribute can also be applied to individual operations.</p><p>Here is an example :</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;model xmlns="http://cxf.apache.org/jaxrs"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;model xmlns="http://cxf.apache.org/jaxrs"&gt;
   &lt;resource name="org.apache.cxf.systest.jaxrs.BookStoreNoAnnotations" path="bookstore"
     produces="application/json" consumes="application/json"&gt;
     &lt;operation name="getBook" verb="GET" path="/books/{id}" produces="application/xml"&gt;
@@ -213,7 +216,7 @@ assertEquals("Get a wrong book id.", 123
 &lt;/model&gt;
 </pre>
 </div></div><p>This model describes two resources, BookStoreNoAnnotations and ChapterNoAnnotations. The BookStoreNoAnnotations resource has three resource operations, 'getBook', 'getBookChapter' and 'updateBook'. Note that the 'getBookChapter' operation element (described in the model) has no 'verb' attribute so runtime will identify it as a subresource locator.<br clear="none"> The runtime will introspect the <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotations.java">org.apache.cxf.systest.jaxrs.BookStoreNoAnnotations</a> class and check the return types for both 'getBook' and 'getBookChapter' methods. BookStoreNoAnnotations.getBookChapter() method's return type is <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ChapterNoAnnotations.java">org.apache.cxf.systest.jaxrs.ChapterN
 oAnnotations</a> so the model will be checked if it contains the resource element with the 'name' attribute equal to 'org.apache.cxf.systest.jaxrs.ChapterNoAnnotations'. After this resource has been found, the ChapterNoAnnotations class is recognized as a sub-resource and then its 'getItself' method is checked.</p><p>Additionally the BookStoreNoAnnotations resource declares that all its resource methods produce 'application/json' mediaTypes, while its 'getBook' method overrides its with its own 'produces' value. BookStoreNoAnnotations resource also has a 'consumes' attribute which requires all of the resource methods (such as 'updateBook') to consume "application/json" formats. The ChapterNoAnnotations 'updateChapter' resource operation requires 'application/xml' formats.</p><p>You can use a comma-seperated list of media type values if needed, for example, produces("application/xml;charset=utf-8,application/json") or consumes("application/xml;charset=utf-8,application/json").</p><p>
 Please also see this <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml">model file</a> for an example. Providing this file will let all implementations of the interface described in this model instance be exposed as RESTful services supported by the JAX-RS runtime.</p><h2 id="JAX-RSAdvancedFeatures-Configuration">Configuration</h2><p>A user model can be referenced in a number of ways. It can be embedded in a jaxrs:server endpoint definition or linked to through a jaxrs:server modelRef attribute as a classpath resource.</p><p>Please see this <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml">bean</a> Spring configuration file, look at jaxrs server beans with 'bookservice6' and 'bookservice7' names.</p><p>Note that when registering a model from Spring you do not need to decla
 re a jaxrs server serviceBeans section - the runtime will instantiate the beans itself. If you do need to inject certain properties into your service bean from Spring then you do need to declare a service bean too. In this case this bean will be instantiated twice - once by the runtime during the model introspection and once by Spring, however in the end it will be the bean created by Spring that will be used, the one created by the runtime will be removed.<br clear="none"> You can avoid this double instantiation by having your model describing the interfaces which the actual root resource beans will implement. In this case only Spring will create a bean and the runtime will apply the model description to this injected bean. Note that if Spring proxifies your bean (for example by applying transaction aspects to it) then the model does have to describe an interface for a match between the model and the injected bean proxy to succeed.</p><p>Please have a look at <a shape="rect" class=
 "external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_proxy/WEB-INF/beans.xml">this Spring bean</a>. The jaxrs endpoint with id 'bookservice2' will have BookStoreWithNoAnnotations created twice but it will be the Spring created BookStoreWithNoAnnotations bean that will serve as a resource class instance. The jaxrs endpoint with id 'bookservice3' will have BookStoreWithNoAnnotationsImpl class instantiated only by Spring, with the model describing BookStoreWithNoAnnotationsInterface only that this class implements.</p><p>You can also register a model programmatically, for 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;">JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
             sf.setAddress("http://localhost:9080/");
 String modelRef = "classpath:/org/apache/cxf/systest/jaxrs/resources/resources2.xml";
 sf.setModelRef(modelRef);
@@ -225,14 +228,14 @@ sf.setModelRef(modelRef);
 sf.setServiceBeans(new BookStoreNoAnnotationsImpl());
 </pre>
 </div></div><p>Please also see <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerUserResourceTest.java">this system test</a> for the example of how model beans like UserResource can be created and registered programmatically.</p><p>Similarly, you can register a user model on the client side, either from jaxrs:client or programmatically, 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;">JAXRSClientFactoryBean cf = new JAXRSClientFactoryBean();
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">JAXRSClientFactoryBean cf = new JAXRSClientFactoryBean();
 cf.setAddress("http://localhost:9080/");
 String modelRef = "classpath:/org/apache/cxf/systest/jaxrs/resources/resources2.xml";
 sf.setModelRef(modelRef);
 BookStoreNoAnnotations proxy = cf.create(BookStoreNoAnnotations.class);
 </pre>
 </div></div><p>At the moment it is only possible to register a user model with CXFNonSpringJAXRSServlet using the latest 2.2.3-SNAPSHOT like the way it is done in this <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml">web.xml</a>. See CXFServlet3 and CXFServlet4 servlet declarations. Note that CXFServlet4 registers a model containing interfaces so it also registers a BookStoreNoAnnotationsImpl service class.</p><p>The workaround is to create a custom servlet :</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;">public class JAXRSUserModelServlet extends CXFNonSpringJaxrsServlet  {
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">public class JAXRSUserModelServlet extends CXFNonSpringJaxrsServlet  {
 
 @Override
 public void loadBus(ServletConfig servletConfig) throws ServletException {

Modified: websites/production/cxf/content/docs/jax-rs-advanced-xml.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-advanced-xml.html (original)
+++ websites/production/cxf/content/docs/jax-rs-advanced-xml.html Tue Sep 12 19:09:41 2017
@@ -32,8 +32,8 @@
 <link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
 
 <script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script>
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -117,17 +117,20 @@ Apache CXF -- JAX-RS Advanced XML
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p></p><p><span class="inline-first-p" style="font-size:2em;font-weight:bold"> JAX-RS : Advanced XML </span></p><p></p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1435780141246 {padding: 0px;}
-div.rbtoc1435780141246 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1435780141246 li {margin-left: 0px;padding-left: 0px;}
+<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p></p><p><span style="font-size:2em;font-weight:bold"> JAX-RS : Advanced XML </span>
+
+
+</p><p></p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
+div.rbtoc1505242976766 {padding: 0px;}
+div.rbtoc1505242976766 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505242976766 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1435780141246">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505242976766">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSAdvancedXML-XPathsupport">XPath support</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSAdvancedXML-Introduction">Introduction</a></li><li><a shape="rect" href="#JAX-RSAdvancedXML-UsingXMLSourceandXPathProviderintheapplicationcode">Using XMLSource and XPathProvider in the application code</a></li></ul>
 </li><li><a shape="rect" href="#JAX-RSAdvancedXML-XSLTsupport">XSLT support</a></li><li><a shape="rect" href="#JAX-RSAdvancedXML-XMLProcessingInstructions">XML Processing Instructions</a></li><li><a shape="rect" href="#JAX-RSAdvancedXML-XSLTTransform">XSLTTransform</a></li><li><a shape="rect" href="#JAX-RSAdvancedXML-XSISchemaLocation">XSI Schema Location</a></li></ul>
 </div><h1 id="JAX-RSAdvancedXML-XPathsupport">XPath support</h1><p>XPath is supported on the server and client sides with the help of <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java">XMLSource</a> utility and <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java">XPathProvider</a> provider classes. The difference between the two is that XPathProvider allows for specifying the XPath expressions in the external configuration.</p><h2 id="JAX-RSAdvancedXML-Introduction">Introduction</h2><p>XMLSource allows for converting matched XML DOM element, attribute and text nodes into typed complex and primitive classes. DOM Node and Element classes as well as JAXP Source and DOMSource can also be used. A single XMLSource instance can be used to query the same input source 
 multiple times if the buffering mode is enabled.</p><p>Here are some examples:</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;">InputStream is = new ByteArrayInputStream("&lt;foo&gt;&lt;bar attr=\"3\"&gt;barValue&lt;/bar&gt;&lt;/foo&gt;".getBytes());
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">InputStream is = new ByteArrayInputStream("&lt;foo&gt;&lt;bar attr=\"3\"&gt;barValue&lt;/bar&gt;&lt;/foo&gt;".getBytes());
 XMLSource xp = new XMLSource(is);
 xp.setBuffering(true);
 // query 1
@@ -143,7 +146,7 @@ Node node = xp.getNode("/foo/bar/@attr",
 assertEquals("3", node.getTextValue());
 </pre>
 </div></div><p>In the above example a primitive attribute node is accessed in a number of ways, using the same XMLSource instance. <br clear="none"> Matched XML complex (element) nodes can be converted in a similar way:</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;">public class Bar {
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">public class Bar {
     @XmlAttribute
     private String attr;  
     public String getAttribute() {
@@ -164,7 +167,7 @@ String value = xp.getValue("/foo/bar");
 assertEquals("&lt;bar attr=\"3\"&gt;barValue&lt;/bar&gt;", value);
 </pre>
 </div></div><p>Note that JAXB is used internally to convert the matched XML element into a class like Bar which does not have to have an @XmlRootElement annotation. The 2nd query in the above example how a String representation of the matched complex node can be captured.</p><p>XMLSource also provides methods for capturing multiple nodes, 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;">InputStream is = new ByteArrayInputStream("&lt;foo&gt;&lt;bar attr=\"3\"&gt;value1&lt;/bar&gt;&lt;bar attr=\"4\"&gt;value2&lt;/bar&gt;&lt;/foo&gt;".getBytes());
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">InputStream is = new ByteArrayInputStream("&lt;foo&gt;&lt;bar attr=\"3\"&gt;value1&lt;/bar&gt;&lt;bar attr=\"4\"&gt;value2&lt;/bar&gt;&lt;/foo&gt;".getBytes());
 XMLSource xp = new XMLSource(is);
 xp.setBuffering(true);
 // query 1
@@ -181,7 +184,7 @@ assertEquals(4, intValues[1]);
 Bar[] nodes = xp.getNodes("/foo/bar", Bar.class);
 </pre>
 </div></div><p>All the above examples have been simplified in that no namespaces have been used. Most real XML instances will have plenty of them and XMLSource has methods accepting optional maps containing prefixes as keys and namespaces as values:</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;">InputStream is = new ByteArrayInputStream("&lt;foo xmlns=\"http://foo\"&gt;&lt;ns1:bar xmlns:ns1=\"http://bar\" attr=\"3\"&gt;barValue&lt;/bar&gt;&lt;/foo&gt;".getBytes());
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">InputStream is = new ByteArrayInputStream("&lt;foo xmlns=\"http://foo\"&gt;&lt;ns1:bar xmlns:ns1=\"http://bar\" attr=\"3\"&gt;barValue&lt;/bar&gt;&lt;/foo&gt;".getBytes());
 XMLSource xp = new XMLSource(is);
 xp.setBuffering(true);
 
@@ -192,7 +195,7 @@ Bar foo = xp.getNode("/ps2:bar", Collect
 assertNotNull(foo);
 </pre>
 </div></div><p>In the above example, a default "http://foo" namespace qualifies the root "foo" element while its 'bar' children are qualified with the <br clear="none"> "http://bar" namespace. Note that XMLSource is configured to make sure these namespaces are checked but the prefixes used do not have to match the ones in the actual XML instance which may not even have them at all, for example, when default namespaces are used.</p><p>XMLSource also provides few methods for capturing attribute or text values representing the HTTP links:</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;">String xmlString = "&lt;customers xmlns=\"http://customers\"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">String xmlString = "&lt;customers xmlns=\"http://customers\"&gt;
                     + "&lt;customer id="1" homepage=\"http://customers/1\"/&gt;"
                     + "&lt;/customers&gt;";
 InputStream is = new ByteArrayInputStream(xmlString.getBytes());
@@ -204,7 +207,7 @@ WebClient client = WebClient.create(home
 // access the home page
 </pre>
 </div></div><p>In the above example the link to the home page of the customer with id equal to '1' is retrieved and is used to create a WebClient instance.</p><p>In some cases, the links are relative. In such cases the base URI is already either known to the application code or it may be specified as the value of the <a shape="rect" class="external-link" href="http://www.w3.org/TR/xmlbase/" rel="nofollow">xml:base</a> attribute. In the latter case XMLSource makes it easy to get this base URI:</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;">String xmlString = "&lt;customers xmlns=\"http://customers\" xml:base="http://customers"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">String xmlString = "&lt;customers xmlns=\"http://customers\" xml:base="http://customers"&gt;
                     + "&lt;customer id="1"/&gt;&lt;customer id="2"/&gt;"
                     + "&lt;/customers&gt;";
 InputStream is = new ByteArrayInputStream(xmlString.getBytes());
@@ -224,7 +227,7 @@ for (URI uri: relativeURIs) {
 }
 </pre>
 </div></div><p>In the last example, a customer id also represents a relative URI, with xml:base attribute pointing to a base URI.<br clear="none"> XMLSource is used to get all the relative URIs, creates a WebClient with the base URI and then iterates using individual relative URIs.</p><h2 id="JAX-RSAdvancedXML-UsingXMLSourceandXPathProviderintheapplicationcode">Using XMLSource and XPathProvider in the application code</h2><p>Please see <a shape="rect" href="http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-XMLcentricclients">this section</a> on how http-centric WebClients can use XPath, and here is an example for the server side:</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;">@Path("/root")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("/root")
 public class Root {
    @POST
    public void post(XMLSource source) {
@@ -233,13 +236,13 @@ public class Root {
 }
 </pre>
 </div></div><p>Users have an option to hide XPath expressions, by registering an XPathProvider which is a JAX-RS MessageBodyReader, either on the client or server sides. For 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;">XPathProvider provider = new XPathProvider();
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">XPathProvider provider = new XPathProvider();
 provider.setGlobalExpression("/books/book[position() = 1]");
 WebClient wc = WebClient.create("http://aggregated/data", Collections.singletonList(provider));
 Book b = wc.get(Book.class);
 </pre>
 </div></div><h1 id="JAX-RSAdvancedXML-XSLTsupport">XSLT support</h1><p>XSLT is currently supported by <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java">XSLTJaxbProvider</a>. This provider works relies on JAXB to initiate the transformation process and can be used to produce pretty much any format, including non-XML ones. Likewise, it can be used to extract XML data out of incoming XML fragments. This provider can be used on the server and client sides.</p><p>Please see this <a shape="rect" class="external-link" href="http://sberyozkin.blogspot.com/2009/05/mvc-xml-way-with-cxf-jax-rs.html" rel="nofollow">blog entry</a> for an overview of how this provider can help with separating the presentation logic from the main application code.</p><p>XSLTJaxbProvider can be configured to handle input or output data, scoped by media types if needed. For example, one may config
 ure it such that one template handles "application/xml" formats only while the other one handles "application/json" writes only.</p><p>XSLTJaxbProvider uses an injected JAX-RS UriInfo to inject all the usual JAX-RS information like template or query parameters into a given XSLT template. These parameters will be injected with the names equal to corresponding @PathParam, QueryParam, etc values. Additionally, an absolute, base and relative path URIs will be injected as "absolute.path", "base.path" and "relative.path" parameters. Finally, custom inParameters and outParameters map properties can also be injected and they will be added to all the XSLT template instances.</p><p>For example, given this resource method definition:</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;">@Path("/root")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("/root")
 public class Root {
    @GET
    @Path("{id}") 
@@ -250,7 +253,7 @@ public class Root {
 }
 </pre>
 </div></div><p>the XSLT templates will have parameters with name 'id' and 'name' injected. In this particular case it may make sense to have two templates, one for processing a Book XML stream (generated by JAXB) only, and the other one for adding HTML specific elements. The HTML-specific template will most likely import the template dealing with the Book stream.</p><p>Here are some examples of how XSLTJaxbTemplate can be configured:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">   &lt;map id="outTemplates"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">   &lt;map id="outTemplates"&gt;
       &lt;entry key="application/xml" value="classpath:/WEB-INF/templates/book-xml.xsl"/&gt;
       &lt;entry key="text/html" value="classpath:/WEB-INF/templates/book-html.xsl"/&gt;
       &lt;entry key="application/json" value="classpath:/WEB-INF/templates/book-json.xsl"/&gt;
@@ -264,27 +267,27 @@ public class Root {
   &lt;/bean&gt;
 </pre>
 </div></div><p>In this example, the provider is injected with three out templates, one for modifying the Book XML stream, the other one - for creating an HTML Book representation and the last one for writing a JSON sequence which the existing JSON providers may not be able to generate.</p><p>A 'uriResolver' property can be used to point to a custom javax.xml.transform.URIResolver implementation which can be used to resolve relative links in few XSLT instructions such as 'import'/etc. A 'systemId' property can also be set. Additionally, inProperties and outProperties map properties can be injected and they will be used when XSLT template instances will be created.</p><p>Here is a simpler configuration example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">   &lt;bean id="xsltProvider" class="org.apache.cxf.jaxrs.provider.XSLTJaxbProvider"&gt;    
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">   &lt;bean id="xsltProvider" class="org.apache.cxf.jaxrs.provider.XSLTJaxbProvider"&gt;    
       &lt;property name="outTemplate" value="classpath:/WEB-INF/templates/book-xml.xsl"/&gt;
       &lt;property name="inTemplate" class="classpath:/WEB-INF/templates/fromNewBookToOldBook.xsl"/&gt;
   &lt;/bean&gt;
 </pre>
 </div></div><p>The provider is configured with one output template and one input template which will apply to all request and response data.</p><p>When XSLTJaxbProvider is used for processing the incoming requests, its main goal is to ensure the incoming XML can be adapted as needed for the JAXB unmarshalling to succeed. The in template can modify the incoming XML in a number of ways or it can extract the XML fragment out of the bigger XML instance which is similar to what XMLSource and XPathProvider can do as well. Please also check the new <a shape="rect" href="http://cxf.apache.org/docs/transformationfeature.html">Transformation</a> feature.</p><p>Note that XSLTJaxbProvider may be used with other XML-aware providers on the same endpoint if needed. In such cases one needs to restrict the set of classes it can handle, for it to not interfere with the other XML provider. This can be done using inClassNames and outClassNames list properties which enumerate supported class names. Alte
 rnatively, a new "supportJaxbOnly" property can be set, in which case XSLTJaxbProvider will simply delegate to JAXBElementProvider if no template is available for a given class.</p><p>Note that when XSLTJaxbProvider is used on the client side, it may not always be possible for template parameters be injected in cases when http-centric clients are used (as opposed to proxies). For 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;">WebClient client = WebClient.create("http://books");
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">WebClient client = WebClient.create("http://books");
 client.path("/store/1").get();
 </pre>
 </div></div><p>it is not possible to deduce that '1' represents a template parameter in the "/store/1" expression. However, one can use the following code instead if '1' needs to be available to XSLT templates :</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;">WebClient client = WebClient.create("http://books");
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">WebClient client = WebClient.create("http://books");
 client.path("/store/{id}", 1).get();
 </pre>
 </div></div><h1 id="JAX-RSAdvancedXML-XMLProcessingInstructions">XML Processing Instructions</h1><p>One way to get outbound XML transformed to HTML or get an XHTML payload further decorated with CSS tags is to <a shape="rect" class="external-link" href="http://www.w3.org/TR/xml-stylesheet/" rel="nofollow">associate an xml-stylesheet processing instruction</a> with the XML payload, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;?xml-stylesheet type="text/xsl" href="http://localhost/myapp/stylesheets/toHTML.xsl"?&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;?xml-stylesheet type="text/xsl" href="http://localhost/myapp/stylesheets/toHTML.xsl"?&gt;
 &lt;products xmlns="http://products"&gt;
    &lt;product id="1"/&gt;
 &lt;/products&gt;
 </pre>
 </div></div><p>The browser will fetch a stylesheet from the server and will transform this XML on the client's machine.<br clear="none"> This option is alternative to using XSLTJaxbProvider to create HTML on the server side. It may become less easy to use if XSL stylesheets importing other documents or rely on additional parameters to produce the HTML but it can definitely be used to offload the cost of doing the transformations from the server in some cases.</p><p>You can also combine XSLTJaxbProvider to create complex HTML on the server and use xml-stylesheet instructions to get the browser to download and cache the CSS stylesheets, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;?xml-stylesheet type="text/css" href="http://localhost/myapp/stylesheets/HTMLDecorator.css"?&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;?xml-stylesheet type="text/css" href="http://localhost/myapp/stylesheets/HTMLDecorator.css"?&gt;
 &lt;! 
    XSLTJaxbProvider transformed the XML products payload into well-formed XHTML.
    The browser will get HTMLDecorator.css at the next step and apply it to this HTML 
@@ -297,7 +300,7 @@ client.path("/store/{id}", 1).get();
 &lt;/html&gt;
 </pre>
 </div></div><p>When working with JAXB, the way to add such xml processing instructions is to set a <br clear="none"> "com.sun.xml.bind.xmlHeaders" or "com.sun.xml.internal.bind.xmlHeaders" on the JAXB Marshaller.</p><p>Up until CXF 2.5.1 the way to do is to use a JAXBElementProvider 'marshallerProperties' map property, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;beans xmlns:util="http://www.springframework.org/schema/util"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;beans xmlns:util="http://www.springframework.org/schema/util"&gt;
 &lt;bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"&gt;
 &lt;map&gt;
 &lt;entry key="com.sun.xml.bind.xmlHeaders" 
@@ -307,7 +310,7 @@ client.path("/store/{id}", 1).get();
 &lt;/beans&gt;
 </pre>
 </div></div><p>The problem here is how to correctly point to an absolute URI identifying the toHTML.xsl resource.<br clear="none"> Assuming that the browser will correctly resolve a relative URI such as "/stylesheets/toHTML.xsl", then all is set.<br clear="none"> Otherwise the best option is to extend JAXBElementProvider and set marshaller properties there by using JAX-RS UriInfo to get to the base request URI.</p><p>Starting from CXF 2.5.1 and 2.4.5 one can use an <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLInstruction.java">XMLInstruction</a> annotation:</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;">@Path("products")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("products")
 public class Resource {
    @GET
    @Produces("application/xml")
@@ -316,13 +319,13 @@ public class Resource {
 }
 </pre>
 </div></div><p>Lets assume one runs a 'myapp' web application with CXFServlet listening on "/services/*", which can accept requests such as "GET <a shape="rect" class="external-link" href="http://localhost/myapp/services/products" rel="nofollow">http://localhost/myapp/services/products</a>".</p><p>The above relative href value will be converted to "http://localhost/myapp/stylesheets/toHTML.xsl" thus making it easy to resources not 'covered' by CXFServlet. What if you prefer not to even list 'stylesheets' in href='/stylesheets/toHTML.xsl' given that the name of the resource folder may change ?<br clear="none"> Use an 'xmlResourceOffset' property of JAXBElementProvider:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"&gt;
 &lt;property name="xmlResourceOffset" value="stylesheets"/&gt;
 &lt;/bean&gt;
 &lt;/beans&gt;
 </pre>
 </div></div><p>and only have href='toHTML.xsl'. You can also use xmlResourceOffset to make sure the absolute URI will be covered by CXFServlet if preferred.</p><h1 id="JAX-RSAdvancedXML-XSLTTransform">XSLTTransform</h1><p>&#160;</p><p><a shape="rect" class="external-link" href="https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSLTTransform.java;h=245106caa903c4ec4612fb65ecc01061004fae67;hb=HEAD">XSLTTransform</a> is a new annotation introduced in CXF 3.0.0. It can support either server or client driven transformations.</p><p>Single XSLTTransform annotation can also support both client and server transformations.</p><p>Its 'mediaTypes' property, if enabled, is used to restrict the server-based transformations to the listed media types only and expected to be a subset of JAX-RS Produces value.</p><p>&#160;</p><p>XSLTTransform can be used in SERVER, CLIENT or BOTH modes.</p><p>For it to be effective for the server s
 ide transformations (SERVER, BOTH), it has to be used in conjunction with XSLTJaxbProvider.</p><p>Default JAXBElementProvider will support XSLTransform CLIENT mode independently.</p><p>When it is used either in CLIENT or BOTH modes to let the clients run the transformations it is processed by JAXBElementProvider and is converted into XML XSL instruction.</p><p>Using it in BOTH mode effectively supports a transformation 'negotiation': the clients which can do the transformation themselves will have an XML XSL instruction added to the response XML payloads,</p><p>and in other case the server will run the transformations.</p><p>Examples:</p><p>&#160;</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;">// server based Products to XML transformation
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">// server based Products to XML transformation
 @Path("products")
 public class Resource {
    @GET
@@ -376,19 +379,19 @@ public class Resource {
 
 &#160;</pre>
 </div></div><p>&#160;</p><p>Typically you do not need to configure either XSLT or JAXB providers with the additional properties for XSLTTransform be effective unless BOTH mode is used, in this case simply set XSLTJaxbProvider "supportJaxbOnly":</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;bean id="xsltProvider" class="org.apache.cxf.jaxrs.provider.XSLTJaxbProvider"&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;bean id="xsltProvider" class="org.apache.cxf.jaxrs.provider.XSLTJaxbProvider"&gt;
 &lt;property name="supportJaxbOnly" value="true"/&gt;
 &lt;/bean&gt;
 </pre>
 </div></div><p>The above configuration is sufficient to have XSLTTransform BOTH mode supported.</p><h1 id="JAX-RSAdvancedXML-XSISchemaLocation">XSI Schema Location</h1><p>Some tools such as <a shape="rect" class="external-link" href="http://office.microsoft.com/en-us/excel-help/get-and-analyze-data-from-the-web-in-excel-HA001054848.aspx" rel="nofollow">Microsoft Excel</a> can do WEB queries and import the XML payload but this payload is expected to use an xsi:schemaLocation attribute pointing to the XML schema document describing this XML, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;products xmlns="http://products"
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;products xmlns="http://products"
    xmlns:xsi=""http://www.w3.org/2000/10/XMLSchema-instance""
    xsi:schemaLocation="http://localhost/myapp/schemas/product.xsd"&gt;
    &lt;product id="1"/&gt;
 &lt;/products&gt;
 </pre>
 </div></div><p>In order to get this attribute set with JAXB, one needs to use a "javax.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION" property which can be set on JAXBElementProvider directly (similarly to the way XML Processing Instructions set, see the previous section) or, starting with CXF 2.5.1, with the help of a new <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java">XSISchemaLocation</a> annotation:</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;">@Path("products")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("products")
 public class Resource {
    @GET
    @Produces("application/xml")

Modified: websites/production/cxf/content/docs/jax-rs-and-jax-ws.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-and-jax-ws.html (original)
+++ websites/production/cxf/content/docs/jax-rs-and-jax-ws.html Tue Sep 12 19:09:41 2017
@@ -32,8 +32,8 @@
 <link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
 
 <script src='/resources/highlighter/scripts/shCore.js'></script>
-<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script>
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -117,15 +117,18 @@ Apache CXF -- JAX-RS and JAX-WS
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><span class="inline-first-p" style="font-size:2em;font-weight:bold"> JAX-RS and JAX-WS </span></p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1435780231420 {padding: 0px;}
-div.rbtoc1435780231420 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1435780231420 li {margin-left: 0px;padding-left: 0px;}
+<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><span style="font-size:2em;font-weight:bold"> JAX-RS and JAX-WS </span>
+
+
+</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
+div.rbtoc1505242962103 {padding: 0px;}
+div.rbtoc1505242962103 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505242962103 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1435780231420">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505242962103">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSandJAX-WS-JAX-RSandJAX-WS">JAX-RS and JAX-WS</a></li><li><a shape="rect" href="#JAX-RSandJAX-WS-Dealingwithcontexts">Dealing with contexts</a></li><li><a shape="rect" href="#JAX-RSandJAX-WS-SharingCXFDataBindings">Sharing CXF DataBindings</a></li><li><a shape="rect" href="#JAX-RSandJAX-WS-SharingJAX-RSProviders">Sharing JAX-RS Providers</a></li><li><a shape="rect" href="#JAX-RSandJAX-WS-Applyingexternalusermodels">Applying external user models</a></li></ul>
 </div><h1 id="JAX-RSandJAX-WS-JAX-RSandJAX-WS">JAX-RS and JAX-WS</h1><p>Here's a beans.xml showing how to have a single service class supporting both SOAP and REST-based invocations at the same time with the help of JAX-WS and JAX-RS :</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
 &lt;beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:jaxrs="http://cxf.apache.org/jaxrs"
@@ -157,18 +160,18 @@ http://cxf.apache.org/schemas/jaxws.xsd"
 &lt;/beans&gt;
 </pre>
 </div></div><p>Either contract-first or Java-first approach can be used for JAX-WS. JAX-RS annotations can be added to the existing service class. Some custom providers may need to be created, depending on the complexity of the method signatures.</p><p>When a WSDL-first approach is used then a document-literal-wrapped style may or may not be a good fit as the code generator unwraps all the types into a signature, for 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;">public class CustomerService {
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">public class CustomerService {
    public void doIt(String a, String b) {...};
 }
 </pre>
 </div></div><p>By default JAX-RS may not be able to handle such methods as it requires that only a single parameter can be available in a signature that is not annotated by one of the JAX-RS annotations like @PathParam. So if <br clear="none"> a 'String a' parameter can be mapped to a @Path template variable or one of the query segments then this signature won't need to be changed :</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;">@Path("/customers/{a}")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("/customers/{a}")
 public class CustomerService {
    public void doIt(@PathParam("a") String a, String b) {...};
 }
 </pre>
 </div></div><p>Note that CXF Continuations API is supported for both JAXWS and JAXRS services.</p><h1 id="JAX-RSandJAX-WS-Dealingwithcontexts">Dealing with contexts</h1><p>When combining JAXWS and JAXRS, one may need to access some context information as part of processing a given request. At the moment, CXF JAXRS does not offer a context implementation which can be used to access a request-specific information common for both JAXWS and JAXRS requests, in cases when the same methods are used to handle both JAXWS and JAXRS requests. Please use a JAXWS WebServiceContext and JAXRS contexts or CXF JAXRS composite MessageContext :</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;">@Path("/customers")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("/customers")
 @WebService
 public class CustomerService {
 
@@ -193,7 +196,7 @@ public class CustomerService {
 }
 </pre>
 </div></div><p>Note that injected context instances (jaxwsContext and jaxrsContext) are in fact thread-local proxies hence they will not be equal to null even if they do not represent a given request. For example, jaxrsContext will not be equal to null even if it's not a JAXWS invocation which is being processed at the moment.</p><p>However, if say a (JAXWS or JAXRS) SecurityContext needs to be accessed then it will be set in, say, jaxwsContext only if it's a JAXWS/SOAP invocation. For this reason it can be handy using a composite CXF JAXRS MessageContext when accessing a JAXRS-specific context information when combining JAXWS and JAXRS as one can easily check if it's actually a JAXRS request by simply checking an individual context like SecurityContext or UriInfo for null.</p><p>Using individual contexts like JAXRS SecurityContext might be less attractive :</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;">@WebService
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@WebService
 public class CustomerService {
    @Context WebServiceContext jaxwsContext;
    // @Resource can be applied too
@@ -201,7 +204,7 @@ public class CustomerService {
 }
 </pre>
 </div></div><p>as some methods of SecurityContext return boolean values so only throwing a runtime exception can reliably indicate that this context is actually not in scope.</p><p>Note that if you do not share the same service methods between JAXRS and JAXWS invocations then you can directly access corresponding contexts :</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;">@Path("/customers")
+<pre class="brush: bash; gutter: false; theme: Confluence" style="font-size:12px;">@Path("/customers")
 @WebService
 public class CustomerService 
 

Modified: websites/production/cxf/content/docs/jax-rs-basics.html
==============================================================================
--- websites/production/cxf/content/docs/jax-rs-basics.html (original)
+++ websites/production/cxf/content/docs/jax-rs-basics.html Tue Sep 12 19:09:41 2017
@@ -32,6 +32,7 @@
 <link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
 
 <script src='/resources/highlighter/scripts/shCore.js'></script>
+<script src='/resources/highlighter/scripts/shBrushBash.js'></script>
 <script src='/resources/highlighter/scripts/shBrushXml.js'></script>
 <script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script>
@@ -121,11 +122,11 @@ Apache CXF -- JAX-RS Basics
 
 
 &#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1505159702449 {padding: 0px;}
-div.rbtoc1505159702449 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1505159702449 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1505243063345 {padding: 0px;}
+div.rbtoc1505243063345 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1505243063345 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1505159702449">
+/*]]>*/</style></p><div class="toc-macro rbtoc1505243063345">
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSBasics-WhatisNewinJAX-RS2.1">What is New in JAX-RS 2.1</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSBasics-ReactiveClientAPI">Reactive Client API</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#JAX-RSBasics-CompletionStage">CompletionStage</a></li><li><a shape="rect" href="#JAX-RSBasics-RxJava">RxJava</a></li></ul>



Mime
View raw message