cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r904547 - in /websites/production/cxf/content: cache/docs.pageCache docs/jax-rs-advanced-xml.html
Date Tue, 01 Apr 2014 12:48:00 GMT
Author: buildbot
Date: Tue Apr  1 12:48:00 2014
New Revision: 904547

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/jax-rs-advanced-xml.html

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

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 Apr  1 12:48:00 2014
@@ -118,32 +118,17 @@ Apache CXF -- JAX-RS Advanced XML
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><p></p><p></p><p><span style="font-size:2em;font-weight:bold"> JAX-RS : Advanced XML </span></p><p></p><p></p><p></p>
+<div id="ConfluenceContent"><p>&#160;</p><p>&#160;</p><p>&#160;</p><span style="font-size:2em;font-weight:bold"> JAX-RS : Advanced XML </span><p>&#160;</p><p>&#160;</p><p>&#160;</p><p><style type="text/css">/*<![CDATA[*/
+div.rbtoc1396356459837 {padding: 0px;}
+div.rbtoc1396356459837 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1396356459837 li {margin-left: 0px;padding-left: 0px;}
 
-<style type="text/css">/*<![CDATA[*/
-div.rbtoc1395395366452 {padding: 0px;}
-div.rbtoc1395395366452 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1395395366452 li {margin-left: 0px;padding-left: 0px;}
-
-/*]]>*/</style><div class="toc-macro rbtoc1395395366452">
+/*]]>*/</style></p><div class="toc-macro rbtoc1396356459837">
 <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-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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-InputStream is = new ByteArrayInputStream(&quot;&lt;foo&gt;&lt;bar attr=\&quot;3\&quot;&gt;barValue&lt;/bar&gt;&lt;/foo&gt;&quot;.getBytes());
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[InputStream is = new ByteArrayInputStream(&quot;&lt;foo&gt;&lt;bar attr=\&quot;3\&quot;&gt;barValue&lt;/bar&gt;&lt;/foo&gt;&quot;.getBytes());
 XMLSource xp = new XMLSource(is);
 xp.setBuffering(true);
 // query 1
@@ -158,14 +143,8 @@ assertEquals(3, intValue);
 Node node = xp.getNode(&quot;/foo/bar/@attr&quot;, Node.class);
 assertEquals(&quot;3&quot;, node.getTextValue());
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-public class Bar {
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public class Bar {
     @XmlAttribute
     private String attr;  
     public String getAttribute() {
@@ -185,15 +164,8 @@ assertEquals(&quot;3&quot;, bean.getAttr
 String value = xp.getValue(&quot;/foo/bar&quot;);
 assertEquals(&quot;&lt;bar attr=\&quot;3\&quot;&gt;barValue&lt;/bar&gt;&quot;, value);
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-InputStream is = new ByteArrayInputStream(&quot;&lt;foo&gt;&lt;bar attr=\&quot;3\&quot;&gt;value1&lt;/bar&gt;&lt;bar attr=\&quot;4\&quot;&gt;value2&lt;/bar&gt;&lt;/foo&gt;&quot;.getBytes());
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[InputStream is = new ByteArrayInputStream(&quot;&lt;foo&gt;&lt;bar attr=\&quot;3\&quot;&gt;value1&lt;/bar&gt;&lt;bar attr=\&quot;4\&quot;&gt;value2&lt;/bar&gt;&lt;/foo&gt;&quot;.getBytes());
 XMLSource xp = new XMLSource(is);
 xp.setBuffering(true);
 // query 1
@@ -209,13 +181,8 @@ assertEquals(4, intValues[1]);
 // query 3
 Bar[] nodes = xp.getNodes(&quot;/foo/bar&quot;, Bar.class);
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-InputStream is = new ByteArrayInputStream(&quot;&lt;foo xmlns=\&quot;http://foo\&quot;&gt;&lt;ns1:bar xmlns:ns1=\&quot;http://bar\&quot; attr=\&quot;3\&quot;&gt;barValue&lt;/bar&gt;&lt;/foo&gt;&quot;.getBytes());
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[InputStream is = new ByteArrayInputStream(&quot;&lt;foo xmlns=\&quot;http://foo\&quot;&gt;&lt;ns1:bar xmlns:ns1=\&quot;http://bar\&quot; attr=\&quot;3\&quot;&gt;barValue&lt;/bar&gt;&lt;/foo&gt;&quot;.getBytes());
 XMLSource xp = new XMLSource(is);
 xp.setBuffering(true);
 
@@ -225,16 +192,8 @@ assertNotNull(foo);
 Bar foo = xp.getNode(&quot;/ps2:bar&quot;, Collections.singletonMap(&quot;ps2&quot;, &quot;http://bar&quot;), Bar.class);
 assertNotNull(foo);
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-String xmlString = &quot;&lt;customers xmlns=\&quot;http://customers\&quot;&gt;
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[String xmlString = &quot;&lt;customers xmlns=\&quot;http://customers\&quot;&gt;
                     + &quot;&lt;customer id=&quot;1&quot; homepage=\&quot;http://customers/1\&quot;/&gt;&quot;
                     + &quot;&lt;/customers&gt;&quot;;
 InputStream is = new ByteArrayInputStream(xmlString.getBytes());
@@ -245,15 +204,8 @@ URI homePage = xp.getLink(&quot;/ps1:cus
 WebClient client = WebClient.create(homePage);
 // access the home page
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-String xmlString = &quot;&lt;customers xmlns=\&quot;http://customers\&quot; xml:base=&quot;http://customers&quot;&gt;
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[String xmlString = &quot;&lt;customers xmlns=\&quot;http://customers\&quot; xml:base=&quot;http://customers&quot;&gt;
                     + &quot;&lt;customer id=&quot;1&quot;/&gt;&lt;customer id=&quot;2&quot;/&gt;&quot;
                     + &quot;&lt;/customers&gt;&quot;;
 InputStream is = new ByteArrayInputStream(xmlString.getBytes());
@@ -272,18 +224,8 @@ for (URI uri: relativeURIs) {
   client.back(true); 
 }
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@Path(&quot;/root&quot;)
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Path(&quot;/root&quot;)
 public class Root {
    @POST
    public void post(XMLSource source) {
@@ -291,35 +233,14 @@ public class Root {
    }    
 }
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-XPathProvider provider = new XPathProvider();
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[XPathProvider provider = new XPathProvider();
 provider.setGlobalExpression(&quot;/books/book[position() = 1]&quot;);
 WebClient wc = WebClient.create(&quot;http://aggregated/data&quot;, Collections.singletonList(provider));
 Book b = wc.get(Book.class);
 ]]></script>
-</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 configure 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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@Path(&quot;/root&quot;)
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Path(&quot;/root&quot;)
 public class Root {
    @GET
    @Path(&quot;{id}&quot;) 
@@ -329,15 +250,8 @@ public class Root {
    }    
 }
 ]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-   &lt;map id=&quot;outTemplates&quot;&gt;
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[   &lt;map id=&quot;outTemplates&quot;&gt;
       &lt;entry key=&quot;application/xml&quot; value=&quot;classpath:/WEB-INF/templates/book-xml.xsl&quot;/&gt;
       &lt;entry key=&quot;text/html&quot; value=&quot;classpath:/WEB-INF/templates/book-html.xsl&quot;/&gt;
       &lt;entry key=&quot;application/json&quot; value=&quot;classpath:/WEB-INF/templates/book-json.xsl&quot;/&gt;
@@ -350,67 +264,28 @@ public class Root {
       &lt;property name=&quot;resolver&quot; ref=&quot;uriResolver&quot;/&gt;
   &lt;/bean&gt;
 ]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-   &lt;bean id=&quot;xsltProvider&quot; class=&quot;org.apache.cxf.jaxrs.provider.XSLTJaxbProvider&quot;&gt;    
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[   &lt;bean id=&quot;xsltProvider&quot; class=&quot;org.apache.cxf.jaxrs.provider.XSLTJaxbProvider&quot;&gt;    
       &lt;property name=&quot;outTemplate&quot; value=&quot;classpath:/WEB-INF/templates/book-xml.xsl&quot;/&gt;
       &lt;property name=&quot;inTemplate&quot; class=&quot;classpath:/WEB-INF/templates/fromNewBookToOldBook.xsl&quot;/&gt;
   &lt;/bean&gt;
 ]]></script>
-</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. Alternatively, 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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-WebClient client = WebClient.create(&quot;http://books&quot;);
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[WebClient client = WebClient.create(&quot;http://books&quot;);
 client.path(&quot;/store/1&quot;).get();
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-WebClient client = WebClient.create(&quot;http://books&quot;);
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[WebClient client = WebClient.create(&quot;http://books&quot;);
 client.path(&quot;/store/{id}&quot;, 1).get();
 ]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;http://localhost/myapp/stylesheets/toHTML.xsl&quot;?&gt;
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;http://localhost/myapp/stylesheets/toHTML.xsl&quot;?&gt;
 &lt;products xmlns=&quot;http://products&quot;&gt;
    &lt;product id=&quot;1&quot;/&gt;
 &lt;/products&gt;
 ]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;?xml-stylesheet type=&quot;text/css&quot; href=&quot;http://localhost/myapp/stylesheets/HTMLDecorator.css&quot;?&gt;
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;?xml-stylesheet type=&quot;text/css&quot; href=&quot;http://localhost/myapp/stylesheets/HTMLDecorator.css&quot;?&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 
@@ -422,15 +297,8 @@ This option is alternative to using XSLT
    &lt;/table&gt;
 &lt;/html&gt;
 ]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;beans xmlns:util=&quot;http://www.springframework.org/schema/util&quot;&gt;
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;beans xmlns:util=&quot;http://www.springframework.org/schema/util&quot;&gt;
 &lt;bean id=&quot;jaxbProvider&quot; class=&quot;org.apache.cxf.jaxrs.provider.JAXBElementProvider&quot;&gt;
 &lt;map&gt;
 &lt;entry key=&quot;com.sun.xml.bind.xmlHeaders&quot; 
@@ -439,16 +307,8 @@ This option is alternative to using XSLT
 &lt;/bean&gt;
 &lt;/beans&gt;
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@Path(&quot;products&quot;)
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Path(&quot;products&quot;)
 public class Resource {
    @GET
    @Produces(&quot;application/xml&quot;)
@@ -456,40 +316,80 @@ public class Resource {
    public Products getProducts() {}
 }
 ]]></script>
-</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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;bean id=&quot;jaxbProvider&quot; class=&quot;org.apache.cxf.jaxrs.provider.JAXBElementProvider&quot;&gt;
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;jaxbProvider&quot; class=&quot;org.apache.cxf.jaxrs.provider.JAXBElementProvider&quot;&gt;
 &lt;property name=&quot;xmlResourceOffset&quot; value=&quot;stylesheets&quot;/&gt;
 &lt;/bean&gt;
 &lt;/beans&gt;
 ]]></script>
-</div></div>
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// server based Products to XML transformation
+@Path(&quot;products&quot;)
+public class Resource {
+   @GET
+   @Produces(&quot;application/xml&quot;)
+   @XSLTTransform(&quot;template.xsl&quot;)
+   public Products getProducts() {}
+}
+
+// server based Products to HTML transformation, 
+// Product to XML is not affected
+@Path(&quot;products&quot;)
+public class Resource {
+   @GET
+   @Produces(&quot;application/xml&quot;, &quot;text/html&quot;)
+   @XSLTTransform(value = &quot;template.xsl&quot;, mediaTypes = {&quot;text/html&quot;})
+   public Products getProducts() {}
+}
+
+// client based Products XML to XML transformation
+@Path(&quot;products&quot;)
+public class Resource {
+   @GET
+   @Produces(&quot;application/xml&quot;)
+   @XSLTTransform(value = &quot;template.xsl&quot;, type = CLIENT)
+   public Products getProducts() {}
+}
+
+// client based Products XML to HTML transformation, 
+// Product to XML is not affected
+@Path(&quot;products&quot;)
+public class Resource {
+   @GET
+   @Produces(&quot;application/xml&quot;, &quot;text/html&quot;)
+   @XSLTTransform(value = &quot;template.xsl&quot;, type = CLIENT, mediaTypes = {&quot;text/html&quot;})
+   public Products getProducts() {}
+}
+
+// clients with &quot;Accept: application/xml&quot; will do Products XML to HTML transformation 
+// clients with &quot;Accept: text/html&quot; will have server-based Products to HTML transformation
+@Path(&quot;products&quot;)
+public class Resource {
+   @GET
+   @Produces(&quot;application/xml&quot;, &quot;text/html&quot;)
+   @XSLTTransform(value = &quot;template.xsl&quot;, type = BOTH, mediaTypes = {&quot;text/html&quot;})
+   public Products getProducts() {}
+} 
+
 
-<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-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">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;products xmlns=&quot;http://products&quot;
+
+ ]]></script>
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;xsltProvider&quot; class=&quot;org.apache.cxf.jaxrs.provider.XSLTJaxbProvider&quot;&gt;
+&lt;property name=&quot;supportJaxbOnly&quot; value=&quot;true&quot;/&gt;
+&lt;/bean&gt;
+]]></script>
+</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">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;products xmlns=&quot;http://products&quot;
    xmlns:xsi=&quot;&quot;http://www.w3.org/2000/10/XMLSchema-instance&quot;&quot;
    xsi:schemaLocation=&quot;http://localhost/myapp/schemas/product.xsd&quot;&gt;
    &lt;product id=&quot;1&quot;/&gt;
 &lt;/products&gt;
 ]]></script>
-</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">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@Path(&quot;products&quot;)
+</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">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Path(&quot;products&quot;)
 public class Resource {
    @GET
    @Produces(&quot;application/xml&quot;)
@@ -497,10 +397,7 @@ public class Resource {
    public Products getProducts() {}
 }
 ]]></script>
-</div></div> 
-
-<p>Please see the previous section on how to affect the absolute URI to a given schema with the help of JAXBElementProvider.<br clear="none">
-Note that XSISchemaLocation may have a noNamespace attribute set to 'true' if a given schema has no target namespace.   </p></div>
+</div></div><p>Please see the previous section on how to affect the absolute URI to a given schema with the help of JAXBElementProvider.<br clear="none"> Note that XSISchemaLocation may have a noNamespace attribute set to 'true' if a given schema has no target namespace.</p></div>
            </div>
            <!-- Content -->
          </td>



Mime
View raw message