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 <a shape="rect" class="external-link"
href="http://wiki.fasterxml.com/JacksonJsonViews" rel="nofollow">JSON
views</a> 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 <a shape="rect" class="external-link"
href="http://wiki.fasterxml.com/JacksonJsonViews" rel="nofollow">JSON
views</a> 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("direct:inPojoAgeView").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[{"age":30,
"weight":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[<pojo age="30"
weight="70"/>]]></script>
</div></div><h3
id="JacksonXML-Include/ExcludefieldsusingthejsonViewattributewithJacksonXMLDataFormat">Include/Exclude
fields using the <code>jsonView</code> attribute
with <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("direct:inPojoAgeView").
@@ -157,16 +157,16 @@ public class MyPojo {
format.setInclude("NON_NULL");]]></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[ <dataFormats>
- <jacksonxml id="json" include="NOT_NULL"/>
+ <jacksonxml id="jacksonxml"
include="NOT_NULL"/>
</dataFormats>]]></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 </span><code>CamelJacksonUnmarshalType</code><span> 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> </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 </span><code>CamelJacksonUnmarshalType</code><span> 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> </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[ <dataFormats>
- <jacksonxml id="json" allowJmsType="true"/>
+ <jacksonxml id="jacksonxml"
allowJmsType="true"/>
</dataFormats>]]></script>
-</div></div><h3
id="JacksonXML-UnmarshallingfromjsontoList<Map>orList<pojo>">Unmarshalling
from json to List<Map> or List<pojo></h3><p>If you are using
Jackson to unmarshal XML to a list of map/pojo, you can now specify this by
setting <code>useList="true"</code> or use
the <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<Map>orList<pojo>">Unmarshalling
from XML to List<Map> or List<pojo></h3><p>If you are using
Jackson to unmarshal XML to a list of map/pojo, you can now specify this by
setting <code>useList="true"</code> or use
the <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);]]
</bean>
Â
<dataFormats>
- <jacksonxml id="json" useList="true"
unmarshalTypeName="com.foo.MyPojo"
moduleRefs="myJacksonModule"/>
+ <jacksonxml id="jacksonxml" useList="true"
unmarshalTypeName="com.foo.MyPojo"
moduleRefs="myJacksonModule"/>
</dataFormats>]]></script>
</div></div><p> 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[ <dataFormats>
- <jacksonxml id="json"
unmarshalTypeName="com.foo.MyPojo"
disableFeatures="FAIL_ON_UNKNOWN_PROPERTIES"/>
+ <jacksonxml id="jacksonxml"
unmarshalTypeName="com.foo.MyPojo"
disableFeatures="FAIL_ON_UNKNOWN_PROPERTIES"/>
</dataFormats>]]></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("direct:m
...
// Later in the processor
Invoice invoice = exchange.getIn().getBody(Invoice.class);]]></script>
-</div></div><p>If there is a
single <code>ObjectMapper</code> instance available in the Camel
registry, it will used by the converter to perform the conversion. Otherwise
the default mapper will be used.  </p><h3
id="JacksonXML-FormattedXMLmarshalling(pretty-printing)">Formatted XML
marshalling (pretty-printing)</h3><p>Using
the <code>prettyPrint</code> option 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 <code>ObjectMapper</code> instance available in the Camel
registry, it will used by the converter to perform the conversion. Otherwise
the default mapper will be used.  </p><h3
id="JacksonXML-FormattedXMLmarshalling(pretty-printing)">Formatted XML
marshalling (pretty-printing)</h3><p>Using
the <code>prettyPrint</code> option one can output a well
formatted XML 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[ <dataFormats>
<jacksonxml id="jack" prettyPrint="true"/>
</dataFormats>]]></script>