You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2015/07/27 15:20:38 UTC
svn commit: r959762 - in /websites/production/camel/content:
book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache
json.html
Author: buildbot
Date: Mon Jul 27 13:20:37 2015
New Revision: 959762
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-dataformat-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/json.html
Modified: websites/production/camel/content/book-dataformat-appendix.html
==============================================================================
--- websites/production/camel/content/book-dataformat-appendix.html (original)
+++ websites/production/camel/content/book-dataformat-appendix.html Mon Jul 27 13:20:37 2015
@@ -475,7 +475,7 @@ oldCSV.setDelimiter("|");
from("direct:start")
.marshal(oldCSV)
.to("mock:result")
-Â
+?
// Camel version >= 2.15
from("direct:start")
.marshal(new CsvDataFormat().setDelimiter('|'))
@@ -681,7 +681,7 @@ from("seda:people").marshal(df
</dependency>
]]></script>
</div></div>
-<h2 id="BookDataFormatAppendix-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="http://xircles.codehaus.org/projects/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency..." paragra
phs further down). By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON <=> XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="BookDataFormatAppendix-UsingJSONdataformatwiththeXStreamlibrary">Using JSON data format with the XStream library</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h2 id="BookDataFormatAppendix-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="https://github.com/FasterXML/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency..." paragraphs furt
her down). By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON <=> XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="BookDataFormatAppendix-UsingJSONdataformatwiththeXStreamlibrary">Using JSON data format with the XStream library</h3><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[// lets turn Object messages into json then send to MQSeries
from("activemq:My.Queue").
marshal().json().
@@ -721,7 +721,7 @@ public class Views {
static class Age { }
}
]]></script>
-</div></div><p>Use the marker classes with the <code>@JsonView</code> annotation to include/exclude certain fields. The annotation also works on getters.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Use the marker classes with the <code>@JsonView</code> annotation to include/exclude certain fields. The annotation also works on getters.<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[
@JsonView(Views.Age.class)
private int age = 30;
@@ -731,12 +731,12 @@ private int height = 190;
@JsonView(Views.Weight.class)
private int weight = 70;
]]></script>
-</div></div><p>Finally use the Camel <code>JacksonDataFormat</code> to marshall the above POJO to JSON.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Finally use the Camel <code>JacksonDataFormat</code> to marshall the above POJO to 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[
JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class);
from("direct:inPojoAgeView").marshal(ageViewFormat);
]]></script>
-</div></div><p>Note that the weight field is missing in the resulting JSON:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</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><p>The GSON library supports a similar feature through the notion of <a shape="rect" class="external-link" href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html" rel="nofollow">ExclusionStrategies</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -757,12 +757,12 @@ protected static class AgeExclusionStrat
}
}
]]></script>
-</div></div><p>The <code>GsonDataFormat</code> accepts an <code>ExclusionStrategy</code> in its constructor:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>The <code>GsonDataFormat</code> accepts an <code>ExclusionStrategy</code> in its constructor:<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[
GsonDataFormat ageExclusionFormat = new GsonDataFormat(TestPojoExclusion.class, new AgeExclusionStrategy());
from("direct:inPojoExcludeAge").marshal(ageExclusionFormat);
]]></script>
-</div></div><p>The line above will exclude fields annotated with <code>@ExcludeAge</code> when marshalling to JSON.</p><h3 id="BookDataFormatAppendix-Configuringfieldnamingpolicy">Configuring field naming policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores.</p><p>We may have this JSON string</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>The line above will exclude fields annotated with <code>@ExcludeAge</code> when marshalling to JSON.<h3 id="BookDataFormatAppendix-Configuringfieldnamingpolicy">Configuring field naming policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores.</p><p>We may have this JSON string</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[{
"id" : 123,
"first_name" : "Donald"
@@ -882,7 +882,7 @@ format.setUnmarshalType(MyPojo.class);]]
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ <bean id="myJacksonModule" class="com.foo.MyModule">
... // configure the module as you want
</bean>
-Â
+?
<dataFormats>
<json id="json" library="Jackson" useList="true" unmarshalTypeName="com.foo.MyPojo" moduleRefs="myJacksonModule"/>
</dataFormats>]]></script>
@@ -909,9 +909,9 @@ Invoice invoice = exchange.getIn().getBo
</dataFormats>]]></script>
</div></div><p><span style="line-height: 1.5625;">And in Java DSL:</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[from("direct:inPretty").marshal().json(true);
-Â
+?
from("direct:inPretty").marshal().json(JsonLibrary.Jackson, true);
-Â
+?
from("direct:inPretty").marshal().json(JsonLibrary.Gson, true);]]></script>
</div></div><p><span style="line-height: 1.5625;">Please note that as of Camel 2.16 there’re 5 different overloaded <code>json()</code> DSL methods which support the <code>prettyPrint</code> option in combination with other settings for <code>JsonLibrary</code>, <code>unmarshalType</code>, <code>jsonView</code> etc. </span></p><h3 id="BookDataFormatAppendix-DependenciesforXStream"><span style="line-height: 1.5625;">Dependencies for XStream</span></h3><p>To use JSON in your camel routes you need to add the a dependency on <strong>camel-xstream</strong> which implements this data format.</p><p>If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see <a shape="rect" href="download.html">the download page for the latest versions</a>).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<dependency>
@@ -971,7 +971,7 @@ from("direct:start").marshal()
<p>In this example we unmarshal a zipped payload from an ActiveMQ queue called MY_QUEUE to its original format, and forward it for processing to the UnZippedMessageProcessor. Note that the compression Level employed during the marshalling should be identical to the one employed during unmarshalling to avoid errors.</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[
-from("activemq:queue:MY_QUEUE").unmarshal().zip().process(new UnZippedMessageProcessor());Â
+from("activemq:queue:MY_QUEUE").unmarshal().zip().process(new UnZippedMessageProcessor());?
]]></script>
</div></div>
@@ -2780,13 +2780,13 @@ from("direct:start")
List<String> expectedSigUserIds = new ArrayList<String>();
expectedSigUserIds.add("Trusted company1");
expectedSigUserIds.add("Trusted company2");
-Â
+?
PGPDataFormat pgpVerifyWithSpecificKeysAndDecrypt = new PGPDataFormat();
pgpVerifyWithSpecificKeysAndDecrypt.setPassword("my password"); // for decrypting with private key
pgpVerifyWithSpecificKeysAndDecrypt.setKeyFileName(keyfileName);
pgpVerifyWithSpecificKeysAndDecrypt.setSignatureKeyFileName(signatgureKeyfileName);
pgpVerifyWithSpecificKeysAndDecrypt.setSignatureKeyUserids(expectedSigUserIds); // if you have only one signer identity then you can also use setSignatureKeyUserid("expected Signer")
-Â
+?
from("direct:start")
...
.unmarshal(pgpVerifyWithSpecificKeysAndDecrypt)
@@ -2802,7 +2802,7 @@ from("direct:start")
signerUserIds.add("company old key");
signerUserIds.add("company new key");
pgpSignAndEncryptSeveralSignerKeys.setSignatureKeyUserids(signerUserIds);
-Â
+?
from("direct:start")
...
.marshal(pgpSignAndEncryptSeveralSignerKeys)
Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Mon Jul 27 13:20:37 2015
@@ -3685,11 +3685,11 @@ The tutorial has been designed in two pa
While not actual tutorials you might find working through the source of the various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul>
<h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</h2><p> </p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Thanks</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This tutorial was kindly donated to Apache Camel by Martin Gilday.</p></div></div><h2 id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the reader through the stages of creating a project which uses Camel to facilitate the routing of messages from a JMS queue to a <a shape="rect" class="external-link" href="http://www.springramework.org" rel="nofollow">Spring</a> service. The route works in a synchronous fashion returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1437927499935 {padding: 0px;}
-div.rbtoc1437927499935 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1437927499935 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1438003117167 {padding: 0px;}
+div.rbtoc1438003117167 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1438003117167 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1437927499935">
+/*]]>*/</style></p><div class="toc-macro rbtoc1438003117167">
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</a></li><li><a shape="rect" href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-About">About</a></li><li><a shape="rect" href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with Dependencies</a></li></ul>
</li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the Server</a>
@@ -5789,11 +5789,11 @@ So we completed the last piece in the pi
<p>This example has been removed from <strong>Camel 2.9</strong> onwards. Apache Axis 1.4 is a very old and unsupported framework. We encourage users to use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div>
<style type="text/css">/*<![CDATA[*/
-div.rbtoc1437927500208 {padding: 0px;}
-div.rbtoc1437927500208 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1437927500208 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1438003117774 {padding: 0px;}
+div.rbtoc1438003117774 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1438003117774 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1437927500208">
+/*]]>*/</style><div class="toc-macro rbtoc1438003117774">
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 1.4 with Apache Camel</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect" href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to run Axis</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect" href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect" href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a shape="rect" href="#BookInOnePage-RunningtheExample">Running the Example</a></li></ul>
@@ -9682,7 +9682,7 @@ from("seda:people").marshal(df
</dependency>
]]></script>
</div></div>
-<h2 id="BookInOnePage-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="http://xircles.codehaus.org/projects/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency..." paragraphs furth
er down). By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON <=> XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="BookInOnePage-UsingJSONdataformatwiththeXStreamlibrary">Using JSON data format with the XStream library</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h2 id="BookInOnePage-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="https://github.com/FasterXML/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency..." paragraphs further down)
. By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON <=> XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="BookInOnePage-UsingJSONdataformatwiththeXStreamlibrary">Using JSON data format with the XStream library</h3><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[// lets turn Object messages into json then send to MQSeries
from("activemq:My.Queue").
marshal().json().
@@ -9722,7 +9722,7 @@ public class Views {
static class Age { }
}
]]></script>
-</div></div><p>Use the marker classes with the <code>@JsonView</code> annotation to include/exclude certain fields. The annotation also works on getters.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Use the marker classes with the <code>@JsonView</code> annotation to include/exclude certain fields. The annotation also works on getters.<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[
@JsonView(Views.Age.class)
private int age = 30;
@@ -9732,12 +9732,12 @@ private int height = 190;
@JsonView(Views.Weight.class)
private int weight = 70;
]]></script>
-</div></div><p>Finally use the Camel <code>JacksonDataFormat</code> to marshall the above POJO to JSON.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Finally use the Camel <code>JacksonDataFormat</code> to marshall the above POJO to 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[
JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class);
from("direct:inPojoAgeView").marshal(ageViewFormat);
]]></script>
-</div></div><p>Note that the weight field is missing in the resulting JSON:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</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><p>The GSON library supports a similar feature through the notion of <a shape="rect" class="external-link" href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html" rel="nofollow">ExclusionStrategies</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -9758,12 +9758,12 @@ protected static class AgeExclusionStrat
}
}
]]></script>
-</div></div><p>The <code>GsonDataFormat</code> accepts an <code>ExclusionStrategy</code> in its constructor:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>The <code>GsonDataFormat</code> accepts an <code>ExclusionStrategy</code> in its constructor:<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[
GsonDataFormat ageExclusionFormat = new GsonDataFormat(TestPojoExclusion.class, new AgeExclusionStrategy());
from("direct:inPojoExcludeAge").marshal(ageExclusionFormat);
]]></script>
-</div></div><p>The line above will exclude fields annotated with <code>@ExcludeAge</code> when marshalling to JSON.</p><h3 id="BookInOnePage-Configuringfieldnamingpolicy">Configuring field naming policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores.</p><p>We may have this JSON string</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>The line above will exclude fields annotated with <code>@ExcludeAge</code> when marshalling to JSON.<h3 id="BookInOnePage-Configuringfieldnamingpolicy">Configuring field naming policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores.</p><p>We may have this JSON string</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[{
"id" : 123,
"first_name" : "Donald"
@@ -17791,11 +17791,11 @@ template.send("direct:alias-verify&
]]></script>
</div></div><p></p><h3 id="BookInOnePage-SeeAlso.28">See Also</h3>
<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul><ul><li><a shape="rect" href="crypto.html">Crypto</a> Crypto is also available as a <a shape="rect" href="data-format.html">Data Format</a></li></ul> <h2 id="BookInOnePage-CXFComponent">CXF Component</h2><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When using CXF as a consumer, the <a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows you to factor out how message payloads are received from their processing as a RESTful or SOAP web service. This has the potential of using a multitude of transports to consume web
services. The bean component's configuration is also simpler and provides the fastest method to implement web services using Camel and CXF.</p></div></div><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When using CXF in streaming modes (see DataFormat option), then also read about <a shape="rect" href="stream-caching.html">Stream caching</a>.</p></div></div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1437927520301 {padding: 0px;}
-div.rbtoc1437927520301 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1437927520301 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1438003135395 {padding: 0px;}
+div.rbtoc1438003135395 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1438003135395 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1437927520301">
+/*]]>*/</style></p><div class="toc-macro rbtoc1438003135395">
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-CXFComponent">CXF Component</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect" href="#BookInOnePage-Options">Options</a>
<ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the dataformats</a>
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/json.html
==============================================================================
--- websites/production/camel/content/json.html (original)
+++ websites/production/camel/content/json.html Mon Jul 27 13:20:37 2015
@@ -86,7 +86,7 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="JSON-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="http://xircles.codehaus.org/projects/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "De
pendency..." paragraphs further down). By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON <=> XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="JSON-UsingJSONdataformatwiththeXStreamlibrary">Using JSON data format with the XStream library</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="JSON-JSON">JSON</h2><p>JSON is a <a shape="rect" href="data-format.html">Data Format</a> to marshal and unmarshal Java objects to and from <a shape="rect" class="external-link" href="http://www.json.org/" rel="nofollow">JSON</a>.</p><p>For JSON to object marshalling, Camel provides integration with three popular JSON libraries:</p><ul class="alternate"><li>The <a shape="rect" class="external-link" href="http://xstream.codehaus.org/" rel="nofollow">XStream library</a> and <a shape="rect" class="external-link" href="http://jettison.codehaus.org/" rel="nofollow">Jettsion </a></li><li>The <a shape="rect" class="external-link" href="https://github.com/FasterXML/jackson" rel="nofollow">Jackson library</a></li><li><strong>Camel 2.10:</strong> The <a shape="rect" class="external-link" href="http://code.google.com/p/google-gson/" rel="nofollow">GSon library</a></li></ul><p>Every library requires adding the special camel component (see "Dependency
..." paragraphs further down). By default Camel uses the XStream library.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Direct, bi-directional JSON <=> XML conversions</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As of Camel 2.10, Camel supports direct, bi-directional JSON <=> XML conversions via the <a shape="rect" href="xmljson.html">camel-xmljson</a> data format, which is documented separately.</p></div></div><h3 id="JSON-UsingJSONdataformatwiththeXStreamlibrary">Using JSON data format with the XStream library</h3><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[// lets turn Object messages into json then send to MQSeries
from("activemq:My.Queue").
marshal().json().
@@ -126,7 +126,7 @@ public class Views {
static class Age { }
}
]]></script>
-</div></div><p>Use the marker classes with the <code>@JsonView</code> annotation to include/exclude certain fields. The annotation also works on getters.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Use the marker classes with the <code>@JsonView</code> annotation to include/exclude certain fields. The annotation also works on getters.<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[
@JsonView(Views.Age.class)
private int age = 30;
@@ -136,12 +136,12 @@ private int height = 190;
@JsonView(Views.Weight.class)
private int weight = 70;
]]></script>
-</div></div><p>Finally use the Camel <code>JacksonDataFormat</code> to marshall the above POJO to JSON.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Finally use the Camel <code>JacksonDataFormat</code> to marshall the above POJO to 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[
JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class, Views.Age.class);
from("direct:inPojoAgeView").marshal(ageViewFormat);
]]></script>
-</div></div><p>Note that the weight field is missing in the resulting JSON:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</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><p>The GSON library supports a similar feature through the notion of <a shape="rect" class="external-link" href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html" rel="nofollow">ExclusionStrategies</a>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -162,12 +162,12 @@ protected static class AgeExclusionStrat
}
}
]]></script>
-</div></div><p>The <code>GsonDataFormat</code> accepts an <code>ExclusionStrategy</code> in its constructor:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>The <code>GsonDataFormat</code> accepts an <code>ExclusionStrategy</code> in its constructor:<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[
GsonDataFormat ageExclusionFormat = new GsonDataFormat(TestPojoExclusion.class, new AgeExclusionStrategy());
from("direct:inPojoExcludeAge").marshal(ageExclusionFormat);
]]></script>
-</div></div><p>The line above will exclude fields annotated with <code>@ExcludeAge</code> when marshalling to JSON.</p><h3 id="JSON-Configuringfieldnamingpolicy">Configuring field naming policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores.</p><p>We may have this JSON string</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>The line above will exclude fields annotated with <code>@ExcludeAge</code> when marshalling to JSON.<h3 id="JSON-Configuringfieldnamingpolicy">Configuring field naming policy</h3><p><strong>Available as of Camel 2.11</strong></p><p>The GSON library supports specifying policies and strategies for mapping from json to POJO fields. A common naming convention is to map json fields using lower case with underscores.</p><p>We may have this JSON string</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[{
"id" : 123,
"first_name" : "Donald"
@@ -287,7 +287,7 @@ format.setUnmarshalType(MyPojo.class);]]
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ <bean id="myJacksonModule" class="com.foo.MyModule">
... // configure the module as you want
</bean>
-Â
+?
<dataFormats>
<json id="json" library="Jackson" useList="true" unmarshalTypeName="com.foo.MyPojo" moduleRefs="myJacksonModule"/>
</dataFormats>]]></script>
@@ -314,9 +314,9 @@ Invoice invoice = exchange.getIn().getBo
</dataFormats>]]></script>
</div></div><p><span style="line-height: 1.5625;">And in Java DSL:</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[from("direct:inPretty").marshal().json(true);
-Â
+?
from("direct:inPretty").marshal().json(JsonLibrary.Jackson, true);
-Â
+?
from("direct:inPretty").marshal().json(JsonLibrary.Gson, true);]]></script>
</div></div><p><span style="line-height: 1.5625;">Please note that as of Camel 2.16 there’re 5 different overloaded <code>json()</code> DSL methods which support the <code>prettyPrint</code> option in combination with other settings for <code>JsonLibrary</code>, <code>unmarshalType</code>, <code>jsonView</code> etc. </span></p><h3 id="JSON-DependenciesforXStream"><span style="line-height: 1.5625;">Dependencies for XStream</span></h3><p>To use JSON in your camel routes you need to add the a dependency on <strong>camel-xstream</strong> which implements this data format.</p><p>If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see <a shape="rect" href="download.html">the download page for the latest versions</a>).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<dependency>