Author: buildbot
Date: Wed Oct 14 07:20:10 2015
New Revision: 968871

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/jackson-xml.html

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

Modified: websites/production/camel/content/jackson-xml.html
==============================================================================
--- websites/production/camel/content/jackson-xml.html (original)
+++ websites/production/camel/content/jackson-xml.html Wed Oct 14 07:20:10 2015
@@ -105,7 +105,7 @@
             <to uri="mock:reverse"/>
         </route>
 ]]></script>
-</div></div><h3 id="JacksonXML-ExcludingPOJOfieldsfrommarshalling">Excluding 
POJO fields from marshalling</h3><p>When marshalling a POJO to JSON you might 
want to exclude certain fields from the JSON output. With Jackson you can 
use&#160;<a shape="rect" class="external-link" 
href="http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON 
views</a>&#160;to accomplish this. First create one or more marker 
classes.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><h3 id="JacksonXML-ExcludingPOJOfieldsfrommarshalling">Excluding 
POJO fields from marshalling</h3><p>When marshalling a POJO to XML you might 
want to exclude certain fields from the XML output. With Jackson you can 
use&#160;<a shape="rect" class="external-link" 
href="http://wiki.fasterxml.com/JacksonJsonViews"; rel="nofollow">JSON 
views</a>&#160;to accomplish this. First create one or more marker 
classes.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 public class Views {
 
@@ -130,8 +130,8 @@ private int weight = 70;
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 
from(&quot;direct:inPojoAgeView&quot;).marshal().jacksonxml(TestPojoView.class, 
Views.Age.class);
 ]]></script>
-</div></div>Note that the weight field is missing in the resulting JSON:<div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[{&quot;age&quot;:30, 
&quot;weight&quot;:70}]]></script>
+</div></div>Note that the weight field is missing in the resulting XML:<div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;pojo age=&quot;30&quot; 
weight=&quot;70&quot;/&gt;]]></script>
 </div></div><h3 
id="JacksonXML-Include/ExcludefieldsusingthejsonViewattributewithJacksonXMLDataFormat">Include/Exclude
 fields using the&#160;<code>jsonView</code>&#160;attribute 
with&#160;<code>JacksonXML</code>DataFormat</h3><p>As an example of using this 
attribute you can instead of:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JacksonXMLDataFormat ageViewFormat = new 
JacksonXMLDataFormat(TestPojoView.class, Views.Age.class);
 from(&quot;direct:inPojoAgeView&quot;).
@@ -157,16 +157,16 @@ public class MyPojo {
 format.setInclude(&quot;NON_NULL&quot;);]]></script>
 </div></div><p>Or from XML DSL you configure this as</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[    &lt;dataFormats&gt;
-      &lt;jacksonxml id=&quot;json&quot; include=&quot;NOT_NULL&quot;/&gt;
+      &lt;jacksonxml id=&quot;jacksonxml&quot; 
include=&quot;NOT_NULL&quot;/&gt;
     &lt;/dataFormats&gt;]]></script>
-</div></div><h3 
id="JacksonXML-UnmarshallingfromXMLtoPOJOwithdynamicclassname">Unmarshalling 
from XML to POJO with dynamic class name</h3><p>If you use jackson to unmarshal 
json to POJO, then you can now specify a header in the message that indicate 
which class name to unmarshal to.<br clear="none"><span>The header has 
key&#160;</span><code>CamelJacksonUnmarshalType</code><span>&#160;if that 
header is present in the message, then Jackson will use that as FQN for the 
POJO class to unmarshal the XML payload 
as.</span></p><p><span>&#160;</span><span>For JMS end users there is the 
JMSType header from the JMS spec that indicates that also. To enable support 
for JMSType you would need to turn that on, on the jackson data format as 
shown:</span></p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><h3 
id="JacksonXML-UnmarshallingfromXMLtoPOJOwithdynamicclassname">Unmarshalling 
from XML to POJO with dynamic class name</h3><p>If you use jackson to unmarshal 
XML to POJO, then you can now specify a header in the message that indicate 
which class name to unmarshal to.<br clear="none"><span>The header has 
key&#160;</span><code>CamelJacksonUnmarshalType</code><span>&#160;if that 
header is present in the message, then Jackson will use that as FQN for the 
POJO class to unmarshal the XML payload 
as.</span></p><p><span>&#160;</span><span>For JMS end users there is the 
JMSType header from the JMS spec that indicates that also. To enable support 
for JMSType you would need to turn that on, on the jackson data format as 
shown:</span></p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JacksonDataFormat format = new 
JacksonDataFormat();
 format.setAllowJmsType(true);]]></script>
 </div></div><p>Or from XML DSL you configure this as</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[    &lt;dataFormats&gt;
-      &lt;jacksonxml id=&quot;json&quot; allowJmsType=&quot;true&quot;/&gt;
+      &lt;jacksonxml id=&quot;jacksonxml&quot; 
allowJmsType=&quot;true&quot;/&gt;
     &lt;/dataFormats&gt;]]></script>
-</div></div><h3 
id="JacksonXML-UnmarshallingfromjsontoList&lt;Map&gt;orList&lt;pojo&gt;">Unmarshalling
 from json to List&lt;Map&gt; or List&lt;pojo&gt;</h3><p>If you are using 
Jackson to unmarshal XML to a list of map/pojo, you can now specify this by 
setting&#160;<code>useList="true"</code>&#160;or use 
the&#160;<code>org.apache.camel.component.jacksonxml.ListJacksonXMLDataFormat</code>.
 For example with Java you can do as shown below:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 
id="JacksonXML-UnmarshallingfromXMLtoList&lt;Map&gt;orList&lt;pojo&gt;">Unmarshalling
 from XML&#160;to List&lt;Map&gt; or List&lt;pojo&gt;</h3><p>If you are using 
Jackson to unmarshal XML to a list of map/pojo, you can now specify this by 
setting&#160;<code>useList="true"</code>&#160;or use 
the&#160;<code>org.apache.camel.component.jacksonxml.ListJacksonXMLDataFormat</code>.
 For example with Java you can do as shown below:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JacksonXMLDataFormat format = new 
ListJacksonXMLDataFormat();
 // or
 JacksonXMLDataFormat format = new JacksonXMLDataFormat();
@@ -191,11 +191,11 @@ format.setUnmarshalType(MyPojo.class);]]
     &lt;/bean&gt;
  
     &lt;dataFormats&gt;
-      &lt;jacksonxml id=&quot;json&quot; useList=&quot;true&quot; 
unmarshalTypeName=&quot;com.foo.MyPojo&quot; 
moduleRefs=&quot;myJacksonModule&quot;/&gt;
+      &lt;jacksonxml id=&quot;jacksonxml&quot; useList=&quot;true&quot; 
unmarshalTypeName=&quot;com.foo.MyPojo&quot; 
moduleRefs=&quot;myJacksonModule&quot;/&gt;
     &lt;/dataFormats&gt;]]></script>
 </div></div><p>&#160;Multiple modules can be specified separated by comma, 
such as moduleRefs="myJacksonModule,myOtherModule"</p><h3 
id="JacksonXML-EnablingordisablefeaturesusingJackson">Enabling or disable 
features using Jackson</h3><p>Jackson has a number of features you can enable 
or disable, which its ObjectMapper uses. For example to disable failing on 
unknown properties when marshalling, you can configure this using the 
disableFeatures:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[ &lt;dataFormats&gt;
-      &lt;jacksonxml id=&quot;json&quot; 
unmarshalTypeName=&quot;com.foo.MyPojo&quot; 
disableFeatures=&quot;FAIL_ON_UNKNOWN_PROPERTIES&quot;/&gt;
+      &lt;jacksonxml id=&quot;jacksonxml&quot; 
unmarshalTypeName=&quot;com.foo.MyPojo&quot; 
disableFeatures=&quot;FAIL_ON_UNKNOWN_PROPERTIES&quot;/&gt;
  &lt;/dataFormats&gt;]]></script>
 </div></div><p>You can disable multiple features by separating the values 
using comma. The values for the features must be the name of the enums from 
Jackson from the following enum 
classes</p><ul><li>com.fasterxml.jackson.databind.SerializationFeature</li><li>com.fasterxml.jackson.databind.DeserializationFeature</li><li>com.fasterxml.jackson.databind.MapperFeature</li></ul><p>To
 enable a feature use the enableFeatures options instead.</p><p>From Java code 
you can use the type safe methods from camel-jackson module:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[JacksonDataFormat df = new 
JacksonDataFormat(MyPojo.class);
@@ -208,7 +208,7 @@ producerTemplate.sendBody(&quot;direct:m
 ...
 // Later in the processor
 Invoice invoice = exchange.getIn().getBody(Invoice.class);]]></script>
-</div></div><p>If there is a 
single&#160;<code>ObjectMapper</code>&#160;instance available in the Camel 
registry, it will used by the converter to perform the conversion. Otherwise 
the default mapper will be used. &#160;</p><h3 
id="JacksonXML-FormattedXMLmarshalling(pretty-printing)">Formatted XML 
marshalling (pretty-printing)</h3><p>Using 
the&#160;<code>prettyPrint</code>&#160;option&#160;one can output a well 
formatted JSON while marshalling:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>If there is a 
single&#160;<code>ObjectMapper</code>&#160;instance available in the Camel 
registry, it will used by the converter to perform the conversion. Otherwise 
the default mapper will be used. &#160;</p><h3 
id="JacksonXML-FormattedXMLmarshalling(pretty-printing)">Formatted XML 
marshalling (pretty-printing)</h3><p>Using 
the&#160;<code>prettyPrint</code>&#160;option&#160;one can output a well 
formatted XML&#160;while marshalling:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[ &lt;dataFormats&gt;
       &lt;jacksonxml id=&quot;jack&quot; prettyPrint=&quot;true&quot;/&gt;
  &lt;/dataFormats&gt;]]></script>


Reply via email to