You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2018/07/25 10:57:30 UTC

svn commit: r1033028 - in /websites/production/cxf/content: cache/docs.pageCache docs/transformationfeature.html

Author: buildbot
Date: Wed Jul 25 10:57:30 2018
New Revision: 1033028

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/transformationfeature.html

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

Modified: websites/production/cxf/content/docs/transformationfeature.html
==============================================================================
--- websites/production/cxf/content/docs/transformationfeature.html (original)
+++ websites/production/cxf/content/docs/transformationfeature.html Wed Jul 25 10:57:30 2018
@@ -118,11 +118,11 @@ Apache CXF -- TransformationFeature
            <!-- Content -->
            <div class="wiki-content">
 <div id="ConfluenceContent"><h1 id="TransformationFeature-TransformationFeature">Transformation Feature</h1><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1524513372063 {padding: 0px;}
-div.rbtoc1524513372063 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1524513372063 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1532516211144 {padding: 0px;}
+div.rbtoc1532516211144 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1532516211144 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1524513372063">
+/*]]>*/</style></p><div class="toc-macro rbtoc1532516211144">
 <ul class="toc-indentation"><li><a shape="rect" href="#TransformationFeature-TransformationFeature">Transformation Feature</a></li><li><a shape="rect" href="#TransformationFeature-Springconfiguration">Spring configuration</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#TransformationFeature-Changinginputandoutputelementnamesandnamespaces">Changing input and output element names and namespaces</a></li><li><a shape="rect" href="#TransformationFeature-Appendingnewinputandoutputelements">Appending new input and output elements</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#TransformationFeature-Append-Pre-Wrap">Append-Pre-Wrap</a></li><li><a shape="rect" href="#TransformationFeature-Append-Post-Wrap">Append-Post-Wrap</a></li><li><a shape="rect" href="#TransformationFeature-Append-Pre-Include">Append-Pre-Include</a></li><li><a shape="rect" href="#TransformationFeature-Append-Post-Include">Append-Post-Include</a></li><li><a shape="rect" href="#TransformationFeature-Comparingfourappendmodes">Comparing four append modes</a></li></ul>
@@ -130,8 +130,8 @@ div.rbtoc1524513372063 li {margin-left:
 </li><li><a shape="rect" href="#TransformationFeature-InputTransformationandRedirection">Input Transformation and Redirection</a></li><li><a shape="rect" href="#TransformationFeature-Configuringthefeaturefromthecode">Configuring the feature from the code</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#TransformationFeature-JAX-WS">JAX-WS</a></li><li><a shape="rect" href="#TransformationFeature-JAX-RS">JAX-RS</a></li></ul>
 </li><li><a shape="rect" href="#TransformationFeature-Transforminterceptorsandphases">Transform interceptors and phases</a></li><li><a shape="rect" href="#TransformationFeature-Defaultnamespaceontheoutput">Default namespace on the output</a></li></ul>
-</div><p>The CXF Transformation feature provides for a flexible and fast way to do dynamic transformation of inbound and/or outbound XML messages.</p><p>This feature can be used in a number of cases: dropping the namespace of the outbound messages, qualifying the incoming message, changing namespaces, appending or dropping elements and converting attributes to elements.</p><p>The "outTransformElements", "inTransformElements", "outDropElements", "inDropElements", "outAppendElements", "inAppendElements" and "attributesAsElements" properties can be used.</p><h1 id="TransformationFeature-Springconfiguration">Spring configuration</h1><h2 id="TransformationFeature-Changinginputandoutputelementnamesandnamespaces">Changing input and output element names and namespaces</h2><p>"outTransformElements" map property can be used to change the output element names and change or drop namespaces. Keys are the elements to be changed, values are the new element names. 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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+</div><p>The CXF Transformation feature provides for a flexible and fast way to do dynamic transformation of inbound and/or outbound XML messages.</p><p>This feature can be used in a number of cases: dropping the namespace of the outbound messages, qualifying the incoming message, changing namespaces, appending or dropping elements and converting attributes to elements.</p><p>The "outTransformElements", "inTransformElements", "outDropElements", "inDropElements", "outAppendElements", "inAppendElements" and "attributesAsElements" properties can be used.</p><p>On the outbound service side, some of the transformation features (e.g. "outTransformElements", "outDropElements") may not work properly prior to CXF versions 3.2.6 and 3.1.17. This is due to outputstream optimization that CXF does. In this case, the outputstream optimization must be explicitly disabled for the outbound transformation feature to work properly by setting the JAX-WS/JAX-RS property "disable.outputstream.optimizatio
 n" to "true".</p><h1 id="TransformationFeature-Springconfiguration">Spring configuration</h1><h2 id="TransformationFeature-Changinginputandoutputelementnamesandnamespaces">Changing input and output element names and namespaces</h2><p>"outTransformElements" map property can be used to change the output element names and change or drop namespaces. Keys are the elements to be changed, values are the new element names. Example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="outTransformElements"&gt;
     &lt;map&gt;
       &lt;!-- change "book" to "thebook" --&gt;
@@ -150,7 +150,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><p>"inTransformElements" map property can be used to change the input element names and change or drop namespaces. See the "outTransfromElements" property description for an example.</p><h2 id="TransformationFeature-Appendingnewinputandoutputelements">Appending new input and output elements</h2><p>"outAppendElements" and "inAppendElements" map properties can be used to append new simple or qualified elements to the output/input in a number of ways. Keys are the elements the new elements will be appended before, values are the new elements. Examples:</p><h3 id="TransformationFeature-Append-Pre-Wrap">Append-Pre-Wrap</h3><p>Using inAppendsElements:</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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="inAppendElements"&gt;
     &lt;map&gt;
       &lt;!-- get "book" wrapped with the new "thebook" element--&gt;
@@ -160,7 +160,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><p>Using outAppendsElements:</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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="outAppendElements"&gt;
     &lt;map&gt;
       &lt;!-- get "book" wrapped with the new "thebook" element--&gt;
@@ -170,7 +170,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><h3 id="TransformationFeature-Append-Post-Wrap">Append-Post-Wrap</h3><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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="inAppendElements"&gt;
     &lt;map&gt;
       &lt;!-- 
@@ -183,7 +183,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><h3 id="TransformationFeature-Append-Pre-Include">Append-Pre-Include</h3><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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="inAppendElements"&gt;
     &lt;map&gt;
       &lt;!-- append new simple "thebook" element with a text value '2' before the "book" element --&gt;
@@ -193,7 +193,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><h3 id="TransformationFeature-Append-Post-Include">Append-Post-Include</h3><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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="inAppendElements"&gt;
     &lt;map&gt;
       &lt;!-- append new simple "thebook" element with a text value '2' using the "/" convention as the last child element within the "book" element --&gt;
@@ -202,7 +202,7 @@ div.rbtoc1524513372063 li {margin-left:
   &lt;/property&gt;
 &lt;/bean&gt; </pre>
 </div></div><h3 id="TransformationFeature-Comparingfourappendmodes">Comparing four append modes</h3><pre>&#160;</pre><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">input</th><th colspan="1" rowspan="1" class="confluenceTh"><p>append-pre-wrap</p><p>&#160;</p></th><th colspan="1" rowspan="1" class="confluenceTh">append-post-wrap</th><th colspan="1" rowspan="1" class="confluenceTh">append-pre-include</th><th colspan="1" rowspan="1" class="confluenceTh">append-post-include</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" class="confluenceTd">key="book" value="thebook"</td><td colspan="1" rowspan="1" class="confluenceTd">key="book/" value="thebook"</td><td colspan="1" rowspan="1" class="confluenceTd">key="book" value="thebook=2"</td><td colspan="1" rowspan="1" class="confluenceTd">key="book/" value="thebook=2"</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd
 "><pre>&lt;sales&gt;<br clear="none"> &lt;book&gt;<br clear="none">  &lt;title&gt;CXF ...&lt;/title&gt;<br clear="none">  &lt;price&gt;38.68&lt;/price&gt;<br clear="none"> &lt;/book&gt;<br clear="none">&lt;/sales&gt;</pre></td><td colspan="1" rowspan="1" class="confluenceTd"><pre>&lt;sales&gt;<br clear="none"> &lt;thebook&gt;<br clear="none">  &lt;book&gt;<br clear="none">   &lt;title&gt;CXF ...&lt;/title&gt;<br clear="none">   &lt;price&gt;38.68&lt;/price&gt;<br clear="none">  &lt;/book&gt;<br clear="none"> &lt;/thebook&gt;<br clear="none">&lt;/sales&gt;</pre></td><td colspan="1" rowspan="1" class="confluenceTd"><pre>&lt;sales&gt;<br clear="none"> &lt;book&gt;<br clear="none">  &lt;thebook&gt;<br clear="none">   &lt;title&gt;CXF ...&lt;/title&gt;<br clear="none">   &lt;price&gt;38.68&lt;/price&gt;<br clear="none">  &lt;/thebook&gt;<br clear="none"> &lt;/book&gt;<br clear="none">&lt;/sales&gt;</pre></td><td colspan="1" rowspan="1" class="confluenceTd"><pre>&lt;sales&gt;<br clear="no
 ne"> &lt;thebook&gt;2&lt;/thebook&gt;<br clear="none"> &lt;book&gt;<br clear="none">  &lt;title&gt;CXF ...&lt;/title&gt;<br clear="none">  &lt;price&gt;38.68&lt;/price&gt;<br clear="none"> &lt;/book&gt;<br clear="none">&lt;/sales&gt;</pre></td><td colspan="1" rowspan="1" class="confluenceTd"><pre>&lt;sales&gt;<br clear="none"> &lt;book&gt;<br clear="none">  &lt;title&gt;CXF ...&lt;/title&gt;<br clear="none">  &lt;price&gt;38.68&lt;/price&gt;<br clear="none">  &lt;thebook&gt;2&lt;/thebook&gt;<br clear="none"> &lt;/book&gt;<br clear="none">&lt;/sales&gt;</pre></td></tr></tbody></table></div><h2 id="TransformationFeature-Replacingtextcontent">Replacing text content</h2><p>It's possible to replace the text content of a given simple element only on the input and output, 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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="inAppendElements"&gt;
     &lt;map&gt;
       &lt;!-- replace the text content of {ns}a element with the 'new Text' value --&gt;
@@ -212,7 +212,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><h2 id="TransformationFeature-Droppingoutputandinputelements">Dropping output and input elements</h2><p>"outDropElements" and "inDropElements" list properties can be used to drop output and input elements. Note that children elements if any of a given dropped element are not affected. Please see the "outDropElements" property description for an example. It's a so-called "shallow" drop.</p><p>Additionally, outTransformElements and inTransformElements property can be used to deep-drop an element and all of its children if any, 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;">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
   &lt;property name="outTransformElements"&gt;
     &lt;map&gt;
       &lt;!-- drop "book" and all of its children, using an empty value convention --&gt;
@@ -223,7 +223,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt; 
 </pre>
 </div></div><h2 id="TransformationFeature-Convertingattributestoelements">Converting attributes to elements</h2><p>"attributesAsElements" boolean property can be used to have attributes serialized as elements on the output only.</p><p>The combination of "attributesAsElements" and "outDropElements" properties can be used to have certain attributes ignored in the output by turning them into elements and then blocking them.</p><h1 id="TransformationFeature-InputTransformationandRedirection">Input Transformation and Redirection</h1><p>Consider the case where a new endpoint has been introduced but some of the existing clients have not been updated yet to work with the new endpoint, they are still unaware of it.</p><p>In this case you may want to keep the CXFServlet serving the old clients but make it redirect them to a new CXFServlet serving a new endpoint only.<br clear="none"> Now, in order to serve the old clients one needs to apply a transform feature, however the new clients should 
 not be affected. Thus the feature can be configured such that it's only triggered if a certain contextual property has been set on a current Message. In this case the feature should only apply to the old redirected clients:</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;">&lt;bean id="transformFeatureRest" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="transformFeatureRest" class="org.apache.cxf.feature.StaxTransformFeature"&gt;
       &lt;!-- 
          apply the transformation only if the boolean property with the given name
          is set to true on the message
@@ -233,7 +233,7 @@ div.rbtoc1524513372063 li {margin-left:
 &lt;/bean&gt;
 </pre>
 </div></div><h1 id="TransformationFeature-Configuringthefeaturefromthecode">Configuring the feature from the code</h1><p>The feature can be configured from the code for JAX-WS or JAX-RS clients and endpoints.</p><h2 id="TransformationFeature-JAX-WS">JAX-WS</h2><p>Here is how a JAX-WS client can be configured:</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;">CustomerServiceService service = new CustomerServiceService();
+<pre class="brush: java; gutter: false; theme: Default">CustomerServiceService service = new CustomerServiceService();
 CustomerService customerService = service.getCustomerServicePort();
 Client client = ClientProxy.getClient(customerService);
 
@@ -253,7 +253,7 @@ client.getInInterceptors().add(transform
 
 </pre>
 </div></div><h2 id="TransformationFeature-JAX-RS">JAX-RS</h2><p>Here is how a JAX-RS client can be configured:</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;">CustomerService customerServiceProxy = JAXRSClientFactory.create(endpointAddress, CustomerService.class);
+<pre class="brush: java; gutter: false; theme: Default">CustomerService customerServiceProxy = JAXRSClientFactory.create(endpointAddress, CustomerService.class);
 
 ClientConfiguration config = WebClient.getConfig(customerServiceProxy);