Modified: websites/production/camel/content/visualisation.html
==============================================================================
--- websites/production/camel/content/visualisation.html (original)
+++ websites/production/camel/content/visualisation.html Tue Sep 22 14:26:24
2015
@@ -75,13 +75,13 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2
id="Visualisation-Visualisation">Visualisation</h2><div
class="confluence-information-macro confluence-information-macro-warning"><span
class="aui-icon aui-icon-small aui-iconfont-error
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This functionality is deprecated
and to be removed in future Camel
releases.</p></div></div><p> </p><p>Camel supports the visualisation of
your <a shape="rect" href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a> using the <a shape="rect" class="external-link"
href="http://graphviz.org" rel="nofollow">GraphViz</a> DOT files which can
either be rendered directly via a suitable GraphViz tool or turned into HTML,
PNG or SVG files via the <a shape="rect" href="camel-maven-plugin.html">Camel
Maven Plugin</a>.</p><p>Here is a <a shape="rect" class="external-link"
href="http://activemq.apache.org/camel/maven/camel-spring/cameldoc/index.html">ty
pical example</a> of the kind of thing we can generate</p><p><span
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image"
src="visualisation.data/org.apache.camel.example.docs.ContentBasedRouteRoute.png"></span></p><p>If
you click on <a shape="rect" class="external-link"
href="http://activemq.apache.org/camel/maven/examples/camel-example-docs/cameldoc/main/routes.html">the
actual generated html</a>you will see that you can navigate from an EIP node
to its pattern page, along with getting hover-over tool tips ec.</p><h3
id="Visualisation-Howtogenerate">How to generate</h3><p>See <a shape="rect"
href="camel-dot-maven-goal.html">Camel Dot Maven Goal</a> or the other maven
goals <a shape="rect" href="camel-maven-plugin.html">Camel Maven
Plugin</a></p><h3 id="Visualisation-ForOSXusers">For OS X users</h3><p>If you
are using OS X then you can open the DOT file using <a shape="rect"
class="external-link" href="http://www.pixelglow.com/graphviz/"
rel="nofollow">grap
hviz</a> which will then automatically re-render if it changes, so you end up
with a real time graphical representation of the topic and queue
hierarchies!</p><p>Also if you want to edit the layout a little before adding
it to a wiki to distribute to your team, open the DOT file with <a shape="rect"
class="external-link" href="http://www.omnigroup.com/applications/omnigraffle/"
rel="nofollow">OmniGraffle</a> then just edit away <img class="emoticon
emoticon-smile"
src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/smile.png"
data-emoticon-name="smile" alt="(smile)"></p></div>
+<div class="wiki-content maincontent"><h2
id="Visualisation-Visualisation">Visualisation</h2><div
class="confluence-information-macro confluence-information-macro-warning"><span
class="aui-icon aui-icon-small aui-iconfont-error
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This functionality is deprecated
and to be removed in future Camel
releases.</p></div></div><p> </p><p>Camel supports the visualisation of
your <a shape="rect" href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a> using the <a shape="rect" class="external-link"
href="http://graphviz.org" rel="nofollow">GraphViz</a> DOT files which can
either be rendered directly via a suitable GraphViz tool or turned into HTML,
PNG or SVG files via the <a shape="rect" href="camel-maven-plugin.html">Camel
Maven Plugin</a>.</p><p>Here is a <a shape="rect" class="external-link"
href="http://activemq.apache.org/camel/maven/camel-spring/cameldoc/index.html">ty
pical example</a> of the kind of thing we can generate</p><p><span
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image"
src="visualisation.data/org.apache.camel.example.docs.ContentBasedRouteRoute.png"
data-image-src="/confluence/download/attachments/64021/org.apache.camel.example.docs.ContentBasedRouteRoute.png?version=1&modificationDate=1229506014000&api=v2"
data-unresolved-comment-count="0" data-linked-resource-id="9437"
data-linked-resource-version="1" data-linked-resource-type="attachment"
data-linked-resource-default-alias="org.apache.camel.example.docs.ContentBasedRouteRoute.png"
data-base-url="https://cwiki.apache.org/confluence"
data-linked-resource-content-type="image/png"
data-linked-resource-container-id="64021"
data-linked-resource-container-version="18"></span></p><p>If you click on <a
shape="rect" class="external-link"
href="http://activemq.apache.org/camel/maven/examples/camel-example-docs/cameldoc/main/routes.html">the
actual gener
ated html</a>you will see that you can navigate from an EIP node to its
pattern page, along with getting hover-over tool tips ec.</p><h3
id="Visualisation-Howtogenerate">How to generate</h3><p>See <a shape="rect"
href="camel-dot-maven-goal.html">Camel Dot Maven Goal</a> or the other maven
goals <a shape="rect" href="camel-maven-plugin.html">Camel Maven
Plugin</a></p><h3 id="Visualisation-ForOSXusers">For OS X users</h3><p>If you
are using OS X then you can open the DOT file using <a shape="rect"
class="external-link" href="http://www.pixelglow.com/graphviz/"
rel="nofollow">graphviz</a> which will then automatically re-render if it
changes, so you end up with a real time graphical representation of the topic
and queue hierarchies!</p><p>Also if you want to edit the layout a little
before adding it to a wiki to distribute to your team, open the DOT file with
<a shape="rect" class="external-link"
href="http://www.omnigroup.com/applications/omnigraffle/"
rel="nofollow">OmniGraffle</a> t
hen just edit away <img class="emoticon emoticon-smile"
src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/smile.png"
data-emoticon-name="smile" alt="(smile)"></p></div>
</td>
<td valign="top">
<div class="navigation">
<div class="navigation_top">
<!-- NavigationBar -->
-<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overviewhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49132"><a
shape="rect" href="overview.html">Overview</a></h3><ul
class="alternate"><li><a shape="rect" href="index.html">Home</a></li><li><a
shape="rect" href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3
id="Navigation-Documentationhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49534"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li>
<li><a shape="rect" href="architecture.html">Architecture</a></li><li><a
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration
Patterns</a></li><li><a shape="rect" href="dsl.html">DSL</a></li><li><a
shape="rect" href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
+<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overview"><a shape="rect"
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li><li><a shape="rect"
href="architecture.html">Architecture</a></li><li><a shape="rect"
href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a></li><li><a shape="rect"
href="dsl.html">DSL</a></li><li><a shape="rect"
href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
<input type="hidden" name="ie" value="UTF-8">
@@ -89,7 +89,7 @@
<input type="submit" name="sa" value="Search">
</div>
</form>
-<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Communityhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49115"><a
shape="rect" href="community.html">Community</a></h3><ul
class="alternate"><li><a shape="rect"
href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developershttps://cwi
ki.apache.org/confluence/pages/viewpage.action?pageId=49124"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"><li><a
shape="rect" href="developers.html">Developer Guide</a></li><li><a shape="rect"
href="source.html">Source</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a shape="rect"
href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
href="irc-room.html">IRC Room</a></li></ul><h3
id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul></div>
+<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Community"><a shape="rect"
href="community.html">Community</a></h3><ul class="alternate"><li><a
shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"
><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a
>shape="rect" href="source.html">Source</a></li><li><a shape="rect"
>href="building.html">Building</a></li><li><a shape="rect"
>href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
>href="irc-room.html">IRC Room</a></li></ul><h3
>id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
>class="alternate"><li><a shape="rect" class="external-link"
>href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
>class="external-link"
>href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
> shape="rect" class="external-link"
>href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
>shape="rect" class="external-link"
>href="http://www.apache.org/security/">Security</a></li></ul></div>
<!-- NavigationBar -->
</div>
</div>
Modified: websites/production/camel/content/what-are-the-dependencies.html
==============================================================================
--- websites/production/camel/content/what-are-the-dependencies.html (original)
+++ websites/production/camel/content/what-are-the-dependencies.html Tue Sep 22
14:26:24 2015
@@ -81,7 +81,7 @@
<div class="navigation">
<div class="navigation_top">
<!-- NavigationBar -->
-<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overviewhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49132"><a
shape="rect" href="overview.html">Overview</a></h3><ul
class="alternate"><li><a shape="rect" href="index.html">Home</a></li><li><a
shape="rect" href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3
id="Navigation-Documentationhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49534"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li>
<li><a shape="rect" href="architecture.html">Architecture</a></li><li><a
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration
Patterns</a></li><li><a shape="rect" href="dsl.html">DSL</a></li><li><a
shape="rect" href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
+<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overview"><a shape="rect"
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li><li><a shape="rect"
href="architecture.html">Architecture</a></li><li><a shape="rect"
href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a></li><li><a shape="rect"
href="dsl.html">DSL</a></li><li><a shape="rect"
href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
<input type="hidden" name="ie" value="UTF-8">
@@ -89,7 +89,7 @@
<input type="submit" name="sa" value="Search">
</div>
</form>
-<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Communityhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49115"><a
shape="rect" href="community.html">Community</a></h3><ul
class="alternate"><li><a shape="rect"
href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developershttps://cwi
ki.apache.org/confluence/pages/viewpage.action?pageId=49124"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"><li><a
shape="rect" href="developers.html">Developer Guide</a></li><li><a shape="rect"
href="source.html">Source</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a shape="rect"
href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
href="irc-room.html">IRC Room</a></li></ul><h3
id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul></div>
+<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Community"><a shape="rect"
href="community.html">Community</a></h3><ul class="alternate"><li><a
shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"
><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a
>shape="rect" href="source.html">Source</a></li><li><a shape="rect"
>href="building.html">Building</a></li><li><a shape="rect"
>href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
>href="irc-room.html">IRC Room</a></li></ul><h3
>id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
>class="alternate"><li><a shape="rect" class="external-link"
>href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
>class="external-link"
>href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
> shape="rect" class="external-link"
>href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
>shape="rect" class="external-link"
>href="http://www.apache.org/security/">Security</a></li></ul></div>
<!-- NavigationBar -->
</div>
</div>
Modified:
websites/production/camel/content/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html
==============================================================================
---
websites/production/camel/content/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html
(original)
+++
websites/production/camel/content/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html
Tue Sep 22 14:26:24 2015
@@ -93,46 +93,46 @@
<p>For example as shown in the route below where we use the <a shape="rect"
href="load-balancer.html">Load Balancer</a> inside the <a shape="rect"
href="content-based-router.html">Content Based Router</a> in the first when:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Code will not
compile</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
-from("direct:start")
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
+from("direct:start")
.choice()
- .when(body().contains("Camel"))
- .loadBalance().roundRobin().to("mock:foo").to("mock:bar")
+ .when(body().contains("Camel"))
+
.loadBalance().roundRobin().to("mock:foo").to("mock:bar")
.otherwise()
- .to("mock:result");
-</pre>
+ .to("mock:result");
+]]></script>
</div></div>
<p>Well the first issue is that the <a shape="rect"
href="load-balancer.html">Load Balancer</a> uses the additional routing to know
what to use in the load balancing. In this example that would be the:</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;">
-.to("mock:foo").to("mock:bar")
-</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
+.to("mock:foo").to("mock:bar")
+]]></script>
</div></div>
<p>To indicate when the balancing stops, you should use <code>.end()</code> to
denote the end. So the route is updates as follows:</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Code will still not
compile</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
-from("direct:start")
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
+from("direct:start")
.choice()
- .when(body().contains("Camel"))
- .loadBalance().roundRobin().to("mock:foo").to("mock:bar").end()
+ .when(body().contains("Camel"))
+
.loadBalance().roundRobin().to("mock:foo").to("mock:bar").end()
.otherwise()
- .to("mock:result");
-</pre>
+ .to("mock:result");
+]]></script>
</div></div>
<p>But the code will still not compile. The reason is we have stretched how
far we can take the good old Java language in terms of <a shape="rect"
href="dsl.html">DSL</a>. In a more modern language such as <a shape="rect"
href="scala-dsl.html">Scala</a> or <a shape="rect"
href="groovy.html">Groovy</a> you would be able to let it be stack based, so
the <code>.end()</code> will pop the last type of the stack, and you would
return back to the scope of the <a shape="rect"
href="content-based-router.html">Content Based Router</a>. However that's not
easily doable in Java. So we need to help Java a bit, which you do by using
<code>.endChoice()</code>, which tells Camel to "pop the stack" and return back
to the scope of the <a shape="rect" href="content-based-router.html">Content
Based Router</a>.</p>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>Code
compiles</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">
-from("direct:start")
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
+from("direct:start")
.choice()
- .when(body().contains("Camel"))
-
.loadBalance().roundRobin().to("mock:foo").to("mock:bar").endChoice()
+ .when(body().contains("Camel"))
+
.loadBalance().roundRobin().to("mock:foo").to("mock:bar").endChoice()
.otherwise()
- .to("mock:result");
-</pre>
+ .to("mock:result");
+]]></script>
</div></div>
<p>You only need to use <code>.endChoice()</code> when using certain <a
shape="rect" href="eip.html">EIP</a>s which often have additional methods to
configure or as part of the <a shape="rect" href="eip.html">EIP</a> itself. For
example the <a shape="rect" href="splitter.html">Splitter</a> EIP has a
sub-route which denotes the routing of each splitted message. You would also
have to use <code>.endChoice()</code> to indicate the end of the sub-route and
to return back to the <a shape="rect" href="content-based-router.html">Content
Based Router</a>. Note <code>.endChoice()</code> is <strong>available as of
Camel 2.7</strong>.</p>
@@ -145,7 +145,7 @@ There can be some combinations of <a sha
<div class="navigation">
<div class="navigation_top">
<!-- NavigationBar -->
-<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overviewhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49132"><a
shape="rect" href="overview.html">Overview</a></h3><ul
class="alternate"><li><a shape="rect" href="index.html">Home</a></li><li><a
shape="rect" href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3
id="Navigation-Documentationhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49534"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li>
<li><a shape="rect" href="architecture.html">Architecture</a></li><li><a
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration
Patterns</a></li><li><a shape="rect" href="dsl.html">DSL</a></li><li><a
shape="rect" href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
+<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overview"><a shape="rect"
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li><li><a shape="rect"
href="architecture.html">Architecture</a></li><li><a shape="rect"
href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a></li><li><a shape="rect"
href="dsl.html">DSL</a></li><li><a shape="rect"
href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
<input type="hidden" name="ie" value="UTF-8">
@@ -153,7 +153,7 @@ There can be some combinations of <a sha
<input type="submit" name="sa" value="Search">
</div>
</form>
-<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Communityhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49115"><a
shape="rect" href="community.html">Community</a></h3><ul
class="alternate"><li><a shape="rect"
href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developershttps://cwi
ki.apache.org/confluence/pages/viewpage.action?pageId=49124"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"><li><a
shape="rect" href="developers.html">Developer Guide</a></li><li><a shape="rect"
href="source.html">Source</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a shape="rect"
href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
href="irc-room.html">IRC Room</a></li></ul><h3
id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul></div>
+<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Community"><a shape="rect"
href="community.html">Community</a></h3><ul class="alternate"><li><a
shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"
><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a
>shape="rect" href="source.html">Source</a></li><li><a shape="rect"
>href="building.html">Building</a></li><li><a shape="rect"
>href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
>href="irc-room.html">IRC Room</a></li></ul><h3
>id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
>class="alternate"><li><a shape="rect" class="external-link"
>href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
>class="external-link"
>href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
> shape="rect" class="external-link"
>href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
>shape="rect" class="external-link"
>href="http://www.apache.org/security/">Security</a></li></ul></div>
<!-- NavigationBar -->
</div>
</div>
Modified: websites/production/camel/content/xmljson.html
==============================================================================
--- websites/production/camel/content/xmljson.html (original)
+++ websites/production/camel/content/xmljson.html Tue Sep 22 14:26:24 2015
@@ -86,89 +86,89 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent"><h2
id="XmlJson-XMLJSONDataFormat(camel-xmljson)">XML JSON Data Format
(camel-xmljson)</h2><p><strong>Available as of Camel 2.10</strong></p><p>Camel
already supports a number of data formats to perform XML and JSON-related
conversions, but all of them require a POJO either as an input (for
marshalling) or produce a POJO as output (for unmarshalling). This data format
provides the capability to convert from XML to JSON and viceversa directly,
without stepping through intermediate POJOs.</p><p>This data format leverages
the <a shape="rect" class="external-link"
href="http://json-lib.sourceforge.net/" rel="nofollow">Json-lib</a> library to
achieve direct conversion. In this context, XML is considered the high-level
format, while JSON is the low-level format. Hence, the marshal/unmarshal
semantics are assigned as follows:</p><ul><li>marshalling => converting from
XML to JSON</li><li>unmarshalling => converting from JSON to
XML.</li></ul><h3 i
d="XmlJson-Options">Options</h3><p>This data format supports the following
options. You can set them via all DSLs. The defaults marked with (*) are
determined by json-lib, rather than the code of the data format itself. They
are reflected here for convenience so that you don't have to dot back and forth
with the json-lib docs.</p><div class="confluenceTableSmall"><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>encoding</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>UTF-8 (*)</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><s
trong>Used when</strong> <span style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span> <strong>(JSON to XML
conversion).</strong> Sets the encoding for the call to <a shape="rect"
class="external-link"
href="http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html#write(net.sf.json.JSON,
java.lang.String)" rel="nofollow"><code>XMLSerializer.write()</code></a>
method, hence it is only used when producing XML. <br clear="none"
class="atl-forced-newline"> When producing JSON, the encoding is determined by
the input String being processed. If the conversion is performed on an
InputStream, json-lib uses the platform's default encoding (e.g. determined by
the <code>file.encoding</code> system property).</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>elementName</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>'e' (*)</p></td><td colspan
="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span
style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
conversion).</strong> Specifies the name of the XML elements representing each
array element. See <a shape="rect" class="external-link"
href="http://json-lib.sourceforge.net/snippets.html#JSONObject_to_XML_change_node_names"
rel="nofollow">json-lib doc</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>arrayName</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>'a' (*)</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Used when</strong> <span style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
conversion).</strong> Specifies the name of the top-level XML element. <br
clear="none" class="atl-forced-newline"> For example, when converting&#
160;<code>[1, 2, 3]</code>, it will be output by default as
<code><a><e>1</e><e>2</e><e>3</e></a></code>.
By setting this option or rootName, you can alter the name of element
'a'.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>rootName</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>none (*)</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span
style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
conversion).</strong> When converting any JSON construct (object, array, null)
to XML (unmarshalling), it specifies the name of the top-level element. <br
clear="none" class="atl-forced-newline"> If not set, json-lib will use
<code>arrayName</code> or <code>objectName</code> (default value: 'o', at
the current time it is not configurab
le in this data format). If set to 'root', the JSON string { 'x': 'value1',
'y' : 'value2' } would turn into
<code><root><x>value1</x><y>value2</y></root></code>,
otherwise the 'root' element would be named 'o'.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>namespaceLenient</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>false (*)</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong>
<span style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
conversion).</strong> According to the json-lib docs: "Flag to be tolerant to
incomplete namespace prefixes." In most cases, json-lib automatically changes
this flag at runtime to match the processing.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>namespaceMappings</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>List<NamespacesPerElementMapping></code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span
style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
conversion).</strong> Binds namespace prefixes and URIs to specific JSON
elements. <code>NamespacesPerElementMapping</code> is a wrapper around an
element name + a Map of prefixes against URIs.</p></td></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>expandableProperties</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>List<String></code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Used when</strong> <span style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
conversion).</strong> With expandable properties, JSON array elements are
converted to XML as a sequence of repetitive XML elements with the local name
equal to the JSON key, for example: { number: 1,2,3 }, normally converted to:
<code><number><e>1</e><e>2</e><e>3</e></number></code>
(where e can be modified by setting elementName), would instead translate to
<code><number>1</number><number>2</number><number>3</number></code>,
if "number" is set as an expandable property</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>typeHints</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>TypeHintsEnum</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>YES</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Used when</strong> <span style="color:
rgb(0,128,0);"><strong>unmarshalling</strong></span><strong> (JSON to XML
convers
ion).</strong> Adds type hints to the resulting XML to aid conversion back to
JSON. See documentation <a shape="rect" class="external-link"
href="http://json-lib.sourceforge.net/apidocs/net/sf/json/xml/XMLSerializer.html"
rel="nofollow">here</a> for an explanation. <code>TypeHintsEnum</code>
comprises the following values, which lead to different combinations of the
underlying XMLSerializer's <code>typeHintsEnabled</code> and
<code>typeHintsCompatibility</code>
flags:</p><ul><li><code>TypeHintsEnum.NO</code> =>
<code>typeHintsEnabled</code> =
false</li><li><code>TypeHintsEnum.YES</code>
=>  <code>typeHintsEnabled</code> =
true,  <code>typeHintsCompatibility</code> =
true</li><li><code>TypeHintsEnum.WITH_PREFIX</code>
=>  <code>typeHintsEnabled</code> =
true,  <code>typeHintsCompatibility</code> =
false</li></ul></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>forceTopLevelObject</code></p></td><td cols
pan="1" rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>false (*)</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong>
<span style="color: rgb(51,51,153);"><strong>marshalling</strong></span>
<strong>(XML to JSON conversion).</strong> Determines whether the resulting
JSON will start off with a top-most element whose name matches the XML root
element. If disabled, XML string
<code><a><x>1</x><y>2</y></a></code> turns
into { 'x: '1', 'y': '2' }. Otherwise, it turns into { 'a':
{ 'x: '1', 'y': '2' }}.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>skipWhitespace</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>false (*)</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <spa
n style="color:
rgb(51,51,153);"><strong>marshalling</strong></span><strong> (XML to JSON
conversion).</strong> Determines whether white spaces between XML elements will
be regarded as text values or disregarded.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>trimSpaces</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false (*)</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span
style="color:
rgb(51,51,153);"><strong>marshalling</strong></span><strong> (XML to JSON
conversion).</strong> Determines whether leading and trailing white spaces will
be omitted from String values.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>skipNamespaces</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>Boolean</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd
"><p>false (*)</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Used when</strong> <span style="color:
rgb(51,51,153);"><strong>marshalling</strong></span><strong> (XML to JSON
conversion).</strong> Signals whether namespaces should be ignored. By default
they will be added to the JSON output using @xmlns
elements.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>removeNamespacePrefixes</code></p></td><td
colspan="1" rowspan="1"
class="confluenceTd"><p><code>Boolean</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>false (*)</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Used when</strong> <span
style="color:
rgb(51,51,153);"><strong>marshalling</strong></span><strong> (XML to JSON
conversion).</strong> Removes the namespace prefixes from XML qualified
elements, so that the resulting JSON string does not contain
them.</p></td></tr></tbody></table></div></div><h3 id="XmlJson-BasicUs
agewithJavaDSL">Basic Usage with Java DSL</h3><h4
id="XmlJson-Explicitlyinstantiatingthedataformat">Explicitly instantiating the
data format</h4><p>Just instantiate the XmlJsonDataFormat from package
org.apache.camel.dataformat.xmljson. Make sure you have installed the
<code>camel-xmljson</code> feature (if running on OSGi) or that you've included
camel-xmljson-{version}.jar and its transitive dependencies in your classpath.
Example initialization with a default configuration:</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;">XmlJsonDataFormat xmlJsonFormat = new
XmlJsonDataFormat();
-</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[XmlJsonDataFormat xmlJsonFormat = new
XmlJsonDataFormat();
+]]></script>
</div></div><p>To tune the behaviour of the data format as per the options
above, use the appropriate setters:</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;">XmlJsonDataFormat xmlJsonFormat = new
XmlJsonDataFormat();
-xmlJsonFormat.setEncoding("UTF-8");
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[XmlJsonDataFormat xmlJsonFormat = new
XmlJsonDataFormat();
+xmlJsonFormat.setEncoding("UTF-8");
xmlJsonFormat.setForceTopLevelObject(true);
xmlJsonFormat.setTrimSpaces(true);
-xmlJsonFormat.setRootName("newRoot");
+xmlJsonFormat.setRootName("newRoot");
xmlJsonFormat.setSkipNamespaces(true);
xmlJsonFormat.setRemoveNamespacePrefixes(true);
-xmlJsonFormat.setExpandableProperties(Arrays.asList("d", "e"));
-</pre>
+xmlJsonFormat.setExpandableProperties(Arrays.asList("d",
"e"));
+]]></script>
</div></div><p>Once you've instantiated the data format, the next step is to
actually use the it from within the <code>marshal()</code> and
<code>unmarshal()</code> DSL elements:</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;">// from XML to JSON
-from("direct:marshal").marshal(xmlJsonFormat).to("mock:json");
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[// from XML to JSON
+from("direct:marshal").marshal(xmlJsonFormat).to("mock:json");
// from JSON to XML
-from("direct:unmarshal").unmarshal(xmlJsonFormat).to("mock:xml");
-</pre>
+from("direct:unmarshal").unmarshal(xmlJsonFormat).to("mock:xml");
+]]></script>
</div></div><h4 id="XmlJson-Definingthedataformatin-line">Defining the data
format in-line</h4><p>Alternatively, you can define the data format inline by
using the <code>xmljson()</code> DSL element.</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;">// from XML to JSON - inline dataformat
-from("direct:marshalInline").marshal().xmljson().to("mock:jsonInline");
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[// from XML to JSON - inline dataformat
+from("direct:marshalInline").marshal().xmljson().to("mock:jsonInline");
// from JSON to XML - inline dataformat
-from("direct:unmarshalInline").unmarshal().xmljson().to("mock:xmlInline");
-</pre>
+from("direct:unmarshalInline").unmarshal().xmljson().to("mock:xmlInline");
+]]></script>
</div></div><p>If you wish, you can even pass in a Map<String, String>
to the inline methods to provide custom options:</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;">Map<String, String> xmlJsonOptions = new
HashMap<String, String>();
-xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.ENCODING,
"UTF-8");
-xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.ROOT_NAME,
"newRoot");
-xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.SKIP_NAMESPACES,
"true");
-xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.REMOVE_NAMESPACE_PREFIXES,
"true");
-xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.EXPANDABLE_PROPERTIES,
"d e");
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[Map<String, String> xmlJsonOptions =
new HashMap<String, String>();
+xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.ENCODING,
"UTF-8");
+xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.ROOT_NAME,
"newRoot");
+xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.SKIP_NAMESPACES,
"true");
+xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.REMOVE_NAMESPACE_PREFIXES,
"true");
+xmlJsonOptions.put(org.apache.camel.model.dataformat.XmlJsonDataFormat.EXPANDABLE_PROPERTIES,
"d e");
// from XML to JSON - inline dataformat w/ options
-from("direct:marshalInlineOptions").marshal().xmljson(xmlJsonOptions).to("mock:jsonInlineOptions");
+from("direct:marshalInlineOptions").marshal().xmljson(xmlJsonOptions).to("mock:jsonInlineOptions");
// form JSON to XML - inline dataformat w/ options
-from("direct:unmarshalInlineOptions").unmarshal().xmljson(xmlJsonOptions).to("mock:xmlInlineOptions");
-</pre>
+from("direct:unmarshalInlineOptions").unmarshal().xmljson(xmlJsonOptions).to("mock:xmlInlineOptions");
+]]></script>
</div></div><h3 id="XmlJson-BasicusagewithSpringorBlueprintDSL">Basic usage
with Spring or Blueprint DSL</h3><p>Within the <code><dataFormats></code>
block, simply configure an <code>xmljson</code> element with unique
IDs:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dataFormats>
- <xmljson id="xmljson"/>
- <xmljson id="xmljsonWithOptions" forceTopLevelObject="true"
trimSpaces="true" rootName="newRoot" skipNamespaces="true"
- removeNamespacePrefixes="true" expandableProperties="d e"/>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<dataFormats>
+ <xmljson id="xmljson"/>
+ <xmljson id="xmljsonWithOptions"
forceTopLevelObject="true" trimSpaces="true"
rootName="newRoot" skipNamespaces="true"
+ removeNamespacePrefixes="true"
expandableProperties="d e"/>
</dataFormats>
-</pre>
+]]></script>
</div></div><p>Then you simply refer to the data format object within your
<code><marshal /></code> and {<unmarshal />}} DSLs:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><route>
- <from uri="direct:marshal"/>
- <marshal ref="xmljson"/>
- <to uri="mock:json" />
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<route>
+ <from uri="direct:marshal"/>
+ <marshal ref="xmljson"/>
+ <to uri="mock:json" />
</route>
<route>
- <from uri="direct:unmarshalWithOptions"/>
- <unmarshal ref="xmljsonWithOptions"/>
- <to uri="mock:xmlWithOptions"/>
+ <from uri="direct:unmarshalWithOptions"/>
+ <unmarshal ref="xmljsonWithOptions"/>
+ <to uri="mock:xmlWithOptions"/>
</route>
-</pre>
+]]></script>
</div></div><p>Enabling XML DSL autocompletion for this component is easy:
just refer to the appropriate <a shape="rect" class="external-link"
href="http://camel.apache.org/xml-reference.html">Schema locations</a>,
depending on whether you're using <a shape="rect" class="external-link"
href="http://camel.apache.org/schema/spring/">Spring</a> or <a shape="rect"
class="external-link"
href="http://camel.apache.org/schema/blueprint/">Blueprint</a> DSL. Remember
that this data format is available from Camel 2.10 onwards, so only schemas
from that version onwards will include these new XML elements and
attributes.</p><p>The syntax with <a shape="rect"
href="using-osgi-blueprint-with-camel.html">Blueprint</a> is identical to that
of the Spring DSL. Just ensure the correct namespaces and schemaLocations are
in use.</p><h3 id="XmlJson-Namespacemappings">Namespace mappings</h3><p>XML has
namespaces to fully qualify elements and attributes; JSON doesn't. You need to
take this into account when
performing XML-JSON conversions.</p><p>To bridge the gap, <a shape="rect"
class="external-link" href="http://json-lib.sourceforge.net/"
rel="nofollow">Json-lib</a> has an option to bind namespace declarations in the
form of prefixes and namespace URIs to XML output elements while unmarshalling
(i.e. converting from JSON to XML). For example, provided the following JSON
string:</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;">{ 'pref1:a': 'value1', 'pref2:b': 'value2 }
-</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[{ 'pref1:a': 'value1',
'pref2:b': 'value2 }
+]]></script>
</div></div><p>you can ask Json-lib to output namespace declarations on
elements "pref1:a" and "pref2:b" to bind the prefixes "pref1" and "pref2" to
specific namespace URIs.</p><p>To use this feature, simply create
<code>XmlJsonDataFormat.NamespacesPerElementMapping</code> objects and add them
to the <code>namespaceMappings</code> option (which is a
<code>List</code>).</p><p>The
<code>XmlJsonDataFormat.NamespacesPerElementMapping</code> holds an element
name and a Map of [prefix => namespace URI]. To facilitate mapping multiple
prefixes and namespace URIs, the <code>NamespacesPerElementMapping(String
element, String pipeSeparatedMappings)</code> constructor takes a String-based
pipe-separated sequence of [prefix, namespaceURI] pairs in the following way:
<code>|ns2|http://camel.apache.org/personalData|ns3|http://camel.apache.org/personalData2|</code>.</p><p>In
order to define a default namespace, just leave the corresponding key field
empty: <code>|ns1|http://camel.apache.org/tes
t1||http://camel.apache.org/default|</code>.</p><p>Binding namespace
declarations to an element name = empty string will attach those namespaces to
the root element.</p><p>The full code would look like that:</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;">XmlJsonDataFormat namespacesFormat = new
XmlJsonDataFormat();
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[XmlJsonDataFormat namespacesFormat = new
XmlJsonDataFormat();
List<XmlJsonDataFormat.NamespacesPerElementMapping> namespaces = new
ArrayList<XmlJsonDataFormat.NamespacesPerElementMapping>();
namespaces.add(new XmlJsonDataFormat.
- NamespacesPerElementMapping("",
"|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|"));
+ NamespacesPerElementMapping("",
"|ns1|http://camel.apache.org/test1||http://camel.apache.org/default|"));
namespaces.add(new XmlJsonDataFormat.
- NamespacesPerElementMapping("surname",
"|ns2|http://camel.apache.org/personalData|" +
- "ns3|http://camel.apache.org/personalData2|"));
+ NamespacesPerElementMapping("surname",
"|ns2|http://camel.apache.org/personalData|" +
+
"ns3|http://camel.apache.org/personalData2|"));
namespacesFormat.setNamespaceMappings(namespaces);
-namespacesFormat.setRootElement("person");
-</pre>
+namespacesFormat.setRootElement("person");
+]]></script>
</div></div><p>And you can achieve the same in Spring DSL.</p><h4
id="XmlJson-Example">Example</h4><p>Using the namespace bindings in the Java
snippet above on the following JSON string:</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;">{ "name": "Raul", "surname": "Kripalani", "f": true,
"g": null}</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[{ "name": "Raul",
"surname": "Kripalani", "f": true, "g":
null}]]></script>
</div></div><p> </p><p>Would yield the following XML:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><person xmlns="http://camel.apache.org/default"
xmlns:ns1="http://camel.apache.org/test1">
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<person
xmlns="http://camel.apache.org/default"
xmlns:ns1="http://camel.apache.org/test1">
<f>true</f>
- <g null="true"/>
+ <g null="true"/>
<name>Raul</name>
- <surname xmlns:ns2="http://camel.apache.org/personalData"
xmlns:ns3="http://camel.apache.org/personalData2">Kripalani</surname>
+ <surname xmlns:ns2="http://camel.apache.org/personalData"
xmlns:ns3="http://camel.apache.org/personalData2">Kripalani</surname>
</person>
-</pre>
+]]></script>
</div></div><p>Remember that the JSON spec defines a JSON object as
follows:</p><blockquote><p>An object is an unordered set of name/value pairs.
[...].</p></blockquote><p>That's why the elements are in a different order in
the output XML.</p><h3 id="XmlJson-Dependencies">Dependencies</h3><p>To use the
<a shape="rect" href="xmljson.html">XmlJson</a> dataformat in your camel routes
you need to add the following dependency to your pom.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xmljson</artifactId>
<version>x.x.x</version>
@@ -181,14 +181,14 @@ license with ASF; so add this manually -
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
-</dependency></pre>
+</dependency>]]></script>
</div></div><h3 id="XmlJson-SeeAlso">See Also</h3><ul><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
class="external-link" href="http://json-lib.sourceforge.net/"
rel="nofollow">json-lib</a></li></ul></div>
</td>
<td valign="top">
<div class="navigation">
<div class="navigation_top">
<!-- NavigationBar -->
-<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overviewhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49132"><a
shape="rect" href="overview.html">Overview</a></h3><ul
class="alternate"><li><a shape="rect" href="index.html">Home</a></li><li><a
shape="rect" href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3
id="Navigation-Documentationhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49534"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li>
<li><a shape="rect" href="architecture.html">Architecture</a></li><li><a
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration
Patterns</a></li><li><a shape="rect" href="dsl.html">DSL</a></li><li><a
shape="rect" href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
+<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overview"><a shape="rect"
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li><li><a shape="rect"
href="architecture.html">Architecture</a></li><li><a shape="rect"
href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a></li><li><a shape="rect"
href="dsl.html">DSL</a></li><li><a shape="rect"
href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
<input type="hidden" name="ie" value="UTF-8">
@@ -196,7 +196,7 @@ license with ASF; so add this manually -
<input type="submit" name="sa" value="Search">
</div>
</form>
-<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Communityhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49115"><a
shape="rect" href="community.html">Community</a></h3><ul
class="alternate"><li><a shape="rect"
href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developershttps://cwi
ki.apache.org/confluence/pages/viewpage.action?pageId=49124"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"><li><a
shape="rect" href="developers.html">Developer Guide</a></li><li><a shape="rect"
href="source.html">Source</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a shape="rect"
href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
href="irc-room.html">IRC Room</a></li></ul><h3
id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul></div>
+<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Community"><a shape="rect"
href="community.html">Community</a></h3><ul class="alternate"><li><a
shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"
><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a
>shape="rect" href="source.html">Source</a></li><li><a shape="rect"
>href="building.html">Building</a></li><li><a shape="rect"
>href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
>href="irc-room.html">IRC Room</a></li></ul><h3
>id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
>class="alternate"><li><a shape="rect" class="external-link"
>href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
>class="external-link"
>href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
> shape="rect" class="external-link"
>href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
>shape="rect" class="external-link"
>href="http://www.apache.org/security/">Security</a></li></ul></div>
<!-- NavigationBar -->
</div>
</div>
Modified: websites/production/camel/content/zip-file-dataformat.html
==============================================================================
--- websites/production/camel/content/zip-file-dataformat.html (original)
+++ websites/production/camel/content/zip-file-dataformat.html Tue Sep 22
14:26:24 2015
@@ -86,61 +86,61 @@
<tr>
<td valign="top" width="100%">
<div class="wiki-content maincontent"><h2 id="ZipFileDataFormat-ZipFile">Zip
File</h2><div class="confluence-information-macro
confluence-information-macro-tip"><p class="title">Available since Camel
2.11.0</p><span class="aui-icon aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"> </div></div><p>The Zip File <a
shape="rect" href="data-format.html">Data Format</a> is a message compression
and de-compression format. Messages can be marshalled (compressed) to Zip files
containing a single entry, and Zip files containing a single entry can be
unmarshalled (decompressed) to the original file contents. This data format
supports ZIP64, as long as <a shape="rect" class="external-link"
href="https://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile"
rel="nofollow">Java 7 or later is being used</a>.</p><p>Since Camel 2.12.3
there is also a aggregation strategy that can aggregate multiple messages in
to a single Zip file.</p><h3 id="ZipFileDataFormat-Marshal">Marshal</h3><p>In
this example we marshal a regular text/XML payload to a compressed payload
using Zip file compression, and send it to an ActiveMQ queue called
MY_QUEUE.</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;">from("direct:start").marshal().zipFile().to("activemq:queue:MY_QUEUE");</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[from("direct:start").marshal().zipFile().to("activemq:queue:MY_QUEUE");]]></script>
</div></div><p>The name of the Zip entry inside the created Zip file is based
on the incoming <code>CamelFileName</code> message header, which is the
standard message header used by the <a shape="rect" href="file2.html">file
component</a>. Additionally, the outgoing <code>CamelFileName</code> message
header is automatically set to the value of the incoming
<code>CamelFileName</code> message header, with the ".zip" suffix. So for
example, if the following route finds a file named "test.txt" in the input
directory, the output will be a Zip file named "test.txt.zip" containing a
single Zip entry named "test.txt":</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;">from("file:input/directory?antInclude=*/.txt").marshal().zipFile().to("file:output/directory");</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[from("file:input/directory?antInclude=*/.txt").marshal().zipFile().to("file:output/directory");]]></script>
</div></div><p>If there is no incoming <code>CamelFileName</code> message
header (for example, if the <a shape="rect" href="file2.html">file
component</a> is not the consumer), then the message ID is used by default, and
since the message ID is normally a unique generated ID, you will end up with
filenames like <code>ID-MACHINENAME-2443-1211718892437-1-0.zip</code>. If you
want to override this behavior, then you can set the value of the
<code>CamelFileName</code> header explicitly in your route:</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;">from("direct:start").setHeader(Exchange.FILE_NAME,
constant("report.txt")).marshal().zipFile().to("file:output/directory");</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[from("direct:start").setHeader(Exchange.FILE_NAME,
constant("report.txt")).marshal().zipFile().to("file:output/directory");]]></script>
</div></div><p>This route would result in a Zip file named "report.txt.zip" in
the output directory, containing a single Zip entry named "report.txt".</p><h3
id="ZipFileDataFormat-Unmarshal">Unmarshal</h3><p>In this example we unmarshal
a Zip file payload from an ActiveMQ queue called MY_QUEUE to its original
format, and forward it for processing to the
<code>UnZippedMessageProcessor</code>.</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;">from("activemq:queue:MY_QUEUE").unmarshal().zipFile().process(new
UnZippedMessageProcessor()); 
-</pre>
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[from("activemq:queue:MY_QUEUE").unmarshal().zipFile().process(new
UnZippedMessageProcessor());Â
+]]></script>
</div></div><p>If the zip file has more then one entry, the usingIterator
option of ZipFileDataFormat to be true, and you can use splitter to do the
further work.</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;"> ZipFileDataFormat zipFile = new ZipFileDataFormat();
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[ ZipFileDataFormat zipFile = new
ZipFileDataFormat();
zipFile.setUsingIterator(true);
-
from("file:src/test/resources/org/apache/camel/dataformat/zipfile/?consumer.delay=1000&noop=true")
+
from("file:src/test/resources/org/apache/camel/dataformat/zipfile/?consumer.delay=1000&noop=true")
.unmarshal(zipFile)
.split(body(Iterator.class))
.streaming()
.process(new UnZippedMessageProcessor())
.end();
-</pre>
+]]></script>
</div></div><p>Or you can use the ZipSplitter as an expression for splitter
directly like this</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;">
from("file:src/test/resources/org/apache/camel/dataformat/zipfile?consumer.delay=1000&noop=true")
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
from("file:src/test/resources/org/apache/camel/dataformat/zipfile?consumer.delay=1000&noop=true")
.split(new ZipSplitter())
.streaming()
.process(new UnZippedMessageProcessor())
.end();
-</pre>
+]]></script>
</div></div><h3 id="ZipFileDataFormat-Aggregate">Aggregate</h3><div
class="confluence-information-macro confluence-information-macro-tip"><p
class="title">Available since Camel 2.12.3</p><span class="aui-icon
aui-icon-small aui-iconfont-approve
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"> </div></div><div><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>Please note that this aggregation
strategy requires eager completion check to work
properly.</p></div></div><p> </p><p>In this example we aggregate all text
files found in the input directory into a singel Zip file that is stored in the
output directory. </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;"> from("file:input/directory?antInclude=*/.txt")
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
from("file:input/directory?antInclude=*/.txt")
.aggregate(new ZipAggregationStrategy())
.constant(true)
.completionFromBatchConsumer()
.eagerCheckCompletion()
- .to("file:output/directory");</pre>
+ .to("file:output/directory");]]></script>
</div></div><p> </p></div><div>The
outgoing <code>CamelFileName</code> message header is created using
 java.io.File.createTempFile, with the ".zip" suffix. If you want to
override this behavior, then you can set the value of
the <code>CamelFileName</code> header explicitly in your
route:</div><div><p> </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;"> from("file:input/directory?antInclude=*/.txt")
+<script class="brush: java; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[
from("file:input/directory?antInclude=*/.txt")
.aggregate(new ZipAggregationStrategy())
.constant(true)
.completionFromBatchConsumer()
.eagerCheckCompletion()
- .setHeader(Exchange.FILE_NAME, constant("reports.zip"))
- .to("file:output/directory");</pre>
+ .setHeader(Exchange.FILE_NAME, constant("reports.zip"))
+ .to("file:output/directory");]]></script>
</div></div><p> </p></div><h3
id="ZipFileDataFormat-Dependencies">Dependencies</h3><p>To use Zip files in
your camel routes you need to add a dependency on
<strong>camel-zipfile</strong> which implements this data format.</p><p>If you
use Maven you can just add the following to your <code>pom.xml</code>,
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">
-<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
+<script class="brush: xml; gutter: false; theme: Default"
type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-zipfile</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
-</pre>
+]]></script>
</div></div></div>
</td>
<td valign="top">
<div class="navigation">
<div class="navigation_top">
<!-- NavigationBar -->
-<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overviewhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49132"><a
shape="rect" href="overview.html">Overview</a></h3><ul
class="alternate"><li><a shape="rect" href="index.html">Home</a></li><li><a
shape="rect" href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3
id="Navigation-Documentationhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49534"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li>
<li><a shape="rect" href="architecture.html">Architecture</a></li><li><a
shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration
Patterns</a></li><li><a shape="rect" href="dsl.html">DSL</a></li><li><a
shape="rect" href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
+<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overview"><a shape="rect"
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li><li><a shape="rect"
href="architecture.html">Architecture</a></li><li><a shape="rect"
href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a></li><li><a shape="rect"
href="dsl.html">DSL</a></li><li><a shape="rect"
href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
<div>
<input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
<input type="hidden" name="ie" value="UTF-8">
@@ -148,7 +148,7 @@
<input type="submit" name="sa" value="Search">
</div>
</form>
-<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Communityhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49115"><a
shape="rect" href="community.html">Community</a></h3><ul
class="alternate"><li><a shape="rect"
href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developershttps://cwi
ki.apache.org/confluence/pages/viewpage.action?pageId=49124"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"><li><a
shape="rect" href="developers.html">Developer Guide</a></li><li><a shape="rect"
href="source.html">Source</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a shape="rect"
href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
href="irc-room.html">IRC Room</a></li></ul><h3
id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul></div>
+<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Community"><a shape="rect"
href="community.html">Community</a></h3><ul class="alternate"><li><a
shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"
><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a
>shape="rect" href="source.html">Source</a></li><li><a shape="rect"
>href="building.html">Building</a></li><li><a shape="rect"
>href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
>href="irc-room.html">IRC Room</a></li></ul><h3
>id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
>class="alternate"><li><a shape="rect" class="external-link"
>href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
>class="external-link"
>href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
> shape="rect" class="external-link"
>href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
>shape="rect" class="external-link"
>href="http://www.apache.org/security/">Security</a></li></ul></div>
<!-- NavigationBar -->
</div>
</div>