Author: buildbot Date: Fri Jun 30 00:37:20 2017 New Revision: 1014747 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/book-in-one-page.html websites/production/camel/content/book-languages-appendix.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/simple.html 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 Fri Jun 30 00:37:20 2017 @@ -3545,11 +3545,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.rbtoc1498778265517 {padding: 0px;} -div.rbtoc1498778265517 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1498778265517 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1498782575222 {padding: 0px;} +div.rbtoc1498782575222 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1498782575222 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1498778265517"> +/*]]>*/</style></p><div class="toc-macro rbtoc1498782575222"> <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> @@ -5664,11 +5664,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.rbtoc1498778265844 {padding: 0px;} -div.rbtoc1498778265844 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1498778265844 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1498782575621 {padding: 0px;} +div.rbtoc1498782575621 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1498782575621 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style><div class="toc-macro rbtoc1498778265844"> +/*]]>*/</style><div class="toc-macro rbtoc1498782575621"> <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> @@ -8071,7 +8071,7 @@ simple("There are ${body.length} li </div></div><h3 id="BookInOnePage-OperatorSupport">Operator Support</h3><p>The parser is limited to only support a single operator. To enable it the left value must be enclosed in <strong><code>${}</code></strong>.</p><p>The syntax is:</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[${leftValue} OP rightValue ]]></script> -</div></div><p>Where the <strong><code>rightValue</code></strong> can be a <strong><code>String</code></strong> literal enclosed in <strong><code>' '</code></strong>, <strong><code>null</code></strong>, a constant value or another expression enclosed in<strong><code> ${}</code></strong>.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>There <em><strong>must</strong></em> be spaces around the operator.</p></div></div><p>Camel will automatically type convert the <strong><code>rightValue</code></strong> type to the <strong><code>leftValue</code></strong> type, so it is possible to for example, convert a string into a numeric so you can use <strong><code>></code></strong> comparison for numeric values.</p><p>The following operators are support ed:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>==</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>=~</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> equals ignore case (will ignore case when comparing <strong><code>String</code></strong> values).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>>=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than or equals.</p></td></tr><tr><td colspan ="1" rowspan="1" class="confluenceTd"><p><code><</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code><=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than or equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>!=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Not equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if not contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>regex</code></p></td><td colspan="1" rowspan="1" class="co nfluenceTd"><p>For matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not regex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For not matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma, eg ',,bronze,silver,gold', which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matchi ng if not in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma. Example: <strong><code>',,bronze,silver,gold'</code></strong>, which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is not an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is not within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>starts with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17.1, 2.18</strong><span>: For testing if the left hand side string starts with the right hand string.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ends with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Ca mel 2.17.1, 2.18</strong>: For testing if the left hand side string ends with the right hand string.</p></td></tr></tbody></table></div><p>And the following unary operators can be used:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>++</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To increment a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>--</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To decrement a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">< p><code>\</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.3 to 2.10.x</strong> To escape a value, e.g., <strong><code>\$</code></strong>, to indicate a <strong><code>$</code></strong> sign. Special: Use <strong><code>\n</code></strong> for new line, <strong><code>\t</code></strong> for tab, and <strong><code>\r</code></strong> for carriage return.</p><p><strong>Note:</strong> Escaping is <strong>not</strong> supported using the <a shape="rect" href="file-language.html"><span style="color: rgb(0,0,0);">File Language</span></a><span style="color: rgb(0,0,0);">.</span></p><p><strong>Note:</strong> from Camel 2.11, <em>the escape character is no longer supported</em>. It has been replaced with the following three escape sequences.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\n</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use newline character.</p> </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\t</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use tab character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\r</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use carriage return character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\</code>}</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.18:</strong> To use the <strong><code>}</code></strong> character as text.</p></td></tr></tbody></table></div><p>And the following logical operators can be used to group expressions:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>and</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>&&</code></strong> instead. The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>or</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>||</code></strong> instead. The logical or operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>&&</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>||</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"> <p><strong>Camel 2.9:</strong> The logical or operator is used to group two expressions.</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Using and,or operators</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>In <strong>Camel 2.4 and older</strong> the <strong><code>and</code></strong> or <strong><code>or</code></strong> can only be used <strong>once</strong> in a simple language expression. From <strong>Camel 2.5</strong>: you can use these operators multiple times.</p></div></div><p>The syntax for <strong><code>AND</code></strong> is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Where the <strong><code>rightValue</code></strong> can be a <strong><code>String</code></strong> literal enclosed in <strong><code>' '</code></strong>, <strong><code>null</code></strong>, a constant value or another expression enclosed in<strong><code> ${}</code></strong>.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>There <em><strong>must</strong></em> be spaces around the operator.</p></div></div><p>Camel will automatically type convert the <strong><code>rightValue</code></strong> type to the <strong><code>leftValue</code></strong> type, so it is possible to for example, convert a string into a numeric so you can use <strong><code>></code></strong> comparison for numeric values.</p><p>The following operators are support ed:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>==</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>=~</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> equals ignore case (will ignore case when comparing <strong><code>String</code></strong> values).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>>=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than or equals.</p></td></tr><tr><td colspan ="1" rowspan="1" class="confluenceTd"><p><code><</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code><=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than or equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>!=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Not equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if not contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>regex</code></p></td><td colspan="1" rowspan="1" class="co nfluenceTd"><p>For matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not regex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For not matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma, eg ',,bronze,silver,gold', which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matchi ng if not in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma. Example: <strong><code>',,bronze,silver,gold'</code></strong>, which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is not an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is not within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>starts with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17.1, 2.18</strong><span>: For testing if the left hand side string starts with the right hand string.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ends with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Ca mel 2.17.1, 2.18</strong>: For testing if the left hand side string ends with the right hand string.</p></td></tr></tbody></table></div><p>And the following unary operators can be used:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>++</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To increment a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>--</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To decrement a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">< p><code>\</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.3 to 2.10.x</strong> To escape a value, e.g., <strong><code>\$</code></strong>, to indicate a <strong><code>$</code></strong> sign. Special: Use <strong><code>\n</code></strong> for new line, <strong><code>\t</code></strong> for tab, and <strong><code>\r</code></strong> for carriage return.</p><p><strong>Note:</strong> Escaping is <strong>not</strong> supported using the <a shape="rect" href="file-language.html"><span style="color: rgb(0,0,0);">File Language</span></a><span style="color: rgb(0,0,0);">.</span></p><p><strong>Note:</strong> from Camel 2.11, <em>the escape character is no longer supported</em>. It has been replaced with the following three escape sequences.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\n</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use newline character.</p> </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\t</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use tab character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\r</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use carriage return character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\</code>}</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.18:</strong> To use the <strong><code>}</code></strong> character as text.</p></td></tr></tbody></table></div><p>And the following logical operators can be used to group expressions:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>and</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>&&</code></strong> instead. The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>or</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>||</code></strong> instead. The logical or operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>&&</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>||</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"> <p><strong>Camel 2.9:</strong> The logical or operator is used to group two expressions.</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Using and,or operators</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>In <strong>Camel 2.4 and older</strong> the <strong><code>and</code></strong> or <strong><code>or</code></strong> can only be used <strong>once</strong> in a simple language expression.</p><p>From <strong>Camel 2.5</strong>: you can use these operators multiple times.</p></div></div><p>The syntax for <strong><code>AND</code></strong> is:</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[${leftValue} OP rightValue and ${leftValue} OP rightValue ]]></script> </div></div><p>And the syntax for <strong><code>OR</code></strong> is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -8128,7 +8128,7 @@ simple("${in.header.type} == ${bean </div></div><p>Ranges are also supported. The range interval requires numbers and both from and end are inclusive. For instance to test whether a value is between <strong><code>100</code></strong> and <strong><code>199</code>:</strong></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[simple("${in.header.number} range 100..199") ]]></script> -</div></div><p>Notice we use <strong><code>..</code></strong> in the range without spaces. It is based on the same syntax as Groovy.</p><p>From <strong>Camel 2.9</strong> onwards the range value must be in single quotes:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Notice we use <strong><code>..</code></strong> in the range without spaces. It is based on the same syntax as Groovy.</p><p>From <strong>Camel 2.9</strong>: the range value must be in single quotes:</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[simple("${in.header.number} range '100..199'") ]]></script> </div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Can be used in Spring XML</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As the Spring XML does not have all the power as the Java DSL with all its various builder methods, you have to resort to use some other languages for testing with simple operators. Now you can do this with the simple language. In the sample below we want to test if the header is a widget order:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -8176,7 +8176,7 @@ simple("${in.header.type} == ${bean .transform().simple("OrderId: ${bean:orderIdGenerator}") .to("mock:reply"); ]]></script> -</div></div><p>Where <code>orderIdGenerator</code> is the id of the bean registered in the <a shape="rect" href="registry.html">Registry</a>. If using Spring then it is the Spring bean id.</p><p>If we want to declare which method to invoke on the order id generator bean we must prepend <strong><code>.method name</code></strong> such as below where we invoke the <code>generateId</code> method.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Where <strong><code>orderIdGenerator</code></strong> is the id of the bean registered in the <a shape="rect" href="registry.html">Registry</a>. If using Spring then it is the Spring bean id.</p><p>If we want to declare which method to invoke on the order id generator bean we must prepend <strong><code>.method name</code></strong> such as below where we invoke the <strong><code>generateId</code></strong> method.</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:order") .transform().simple("OrderId: ${bean:orderIdGenerator.generateId}") .to("mock:reply"); @@ -8186,7 +8186,7 @@ simple("${in.header.type} == ${bean .transform().simple("OrderId: ${bean:orderIdGenerator?method=generateId}") .to("mock:reply"); ]]></script> -</div></div><p>And from Camel 2.3 you can also convert the body to a given type, for example to ensure that it is a <strong><code>String</code></strong> you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>From <strong>Camel 2.3</strong>: you can also convert the body to a given type, for example to ensure that it is a <strong><code>String</code></strong> you can do:</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[<transform> <simple>Hello ${bodyAs(String)} how are you?</simple> </transform> @@ -8196,12 +8196,12 @@ simple("${in.header.type} == ${bean <simple>The gold value is ${header.type[gold]}</simple> </transform> ]]></script> -</div></div><p>In the code above we lookup the header with name <code>type</code> and regard it as a <strong><code>java.util.Map</code></strong> and we then lookup with the key <strong><code>gold</code></strong> and return the value. If the header is not convertible to Map an exception is thrown. If the header with name <strong><code>type</code></strong> does not exist <strong><code>null</code></strong> is returned.</p><p>From Camel 2.9 you can nest functions, such as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>In the code above we lookup the header with name <code>type</code> and regard it as a <strong><code>java.util.Map</code></strong> and we then lookup with the key <strong><code>gold</code></strong> and return the value. If the header is not convertible to Map an exception is thrown. If the header with name <strong><code>type</code></strong> does not exist <strong><code>null</code></strong> is returned.</p><p>From <strong>Camel 2.9</strong>: you can nest functions, such as shown below:</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[<setHeader headerName="myHeader"> <simple>${properties:${header.someKey}}</simple> </setHeader> ]]></script> -</div></div><h4 id="BookInOnePage-ReferringtoConstantsorEnums">Referring to Constants or Enums</h4><p><strong>Available as of Camel 2.11</strong></p><p>Suppose you have an enum for customers</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h4 id="BookInOnePage-ReferringtoConstantsorEnums">Referring to Constants or Enums</h4><p><strong>Available <strong>from</strong> Camel 2.11</strong></p><p>Suppose you have an enum for customers:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ public enum Customer { @@ -8219,17 +8219,17 @@ from("direct:start") .otherwise() .to("mock:other"); ]]></script> -</div></div><h3 id="BookInOnePage-UsingNewLinesorTabsinXMLDSLs">Using New Lines or Tabs in XML DSLs</h3><p><strong>Available as of Camel 2.9.3</strong></p><p>From <strong>Camel 2.9.3</strong>, it is easier to specify new lines or tabs in XML DSLs as you can escape the value now</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookInOnePage-UsingNewLinesorTabsinXMLDSLs">Using New Lines or Tabs in XML DSLs</h3><p><strong>Available <strong>from</strong> Camel 2.9.3</strong></p><p>From <strong>Camel 2.9.3</strong>: it is easier to specify new lines or tabs in XML DSLs as you can escape the value now</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[<transform> <simple>The following text\nis on a new line</simple> </transform> ]]></script> -</div></div><h3 id="BookInOnePage-LeadingandTrailingWhitespaceHandling">Leading and Trailing Whitespace Handling</h3><p><strong>Available as of Camel 2.10.0</strong></p><p>From <strong>Camel 2.10.0</strong>, the <strong><code>trim</code></strong> attribute of the expression can be used to control whether the leading and trailing whitespace characters are removed or preserved. The default of <strong><code>trim=true</code></strong> removes all whitespace characters.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookInOnePage-LeadingandTrailingWhitespaceHandling">Leading and Trailing Whitespace Handling</h3><p><strong>Available <strong>from</strong> Camel 2.10.0</strong></p><p>From <strong>Camel 2.10.0</strong>: the <strong><code>trim</code></strong> attribute of the expression can be used to control whether the leading and trailing whitespace characters are removed or preserved. The default of <strong><code>trim=true</code></strong> removes all whitespace characters.</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[<setBody> <simple trim="false">You get some trailing whitespace characters. </simple> </setBody> ]]></script> -</div></div><h3 id="BookInOnePage-SettingtheResultType">Setting the Result Type</h3><p><strong>Available as of Camel 2.8</strong></p><p>You can now provide a result type to the <a shape="rect" href="simple.html">Simple</a> expression, which means the result of the evaluation will be converted to the desired type. This is most usable to define types such as <code>boolean</code>'s, <code>integer</code>'s, etc.</p><p>For example to set a header as a <strong><code>boolean</code></strong> type you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookInOnePage-SettingtheResultType">Setting the Result Type</h3><p><strong>Available from Camel 2.8</strong></p><p>You can now provide a result type to the <a shape="rect" href="simple.html">Simple</a> expression, which means the result of the evaluation will be converted to the desired type. This is most usable to define types such as <code>boolean</code>'s, <code>integer</code>'s, etc.</p><p>For example to set a header as a <strong><code>boolean</code></strong> type you can do:</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[.setHeader("cool", simple("true", Boolean.class)) ]]></script> </div></div><p>And in XML DSL</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -8238,17 +8238,17 @@ from("direct:start") <simple resultType="java.lang.Boolean">true</simple> </setHeader> ]]></script> -</div></div><h3 id="BookInOnePage-ChangingFunctionStartandEndTokens">Changing Function Start and End Tokens</h3><p><strong>Available as of Camel 2.9.1</strong></p><p>You can configure the function start and end tokens - <strong><code>${}</code></strong> using the setters <strong><code>changeFunctionStartToken</code></strong> and <strong><code>changeFunctionEndToken</code></strong> on <strong><code>SimpleLanguage</code></strong>, using Java code. From Spring XML you can define a <strong><code><bean></code></strong> tag with the new changed tokens in the properties as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookInOnePage-ChangingFunctionStartandEndTokens">Changing Function Start and End Tokens</h3><p><strong>Available <strong>from</strong> Camel 2.9.1</strong></p><p>You can configure the function start and end tokens - <strong><code>${}</code></strong> using the setters <strong><code>changeFunctionStartToken</code></strong> and <strong><code>changeFunctionEndToken</code></strong> on <strong><code>SimpleLanguage</code></strong>, using Java code. From Spring XML you can define a <strong><code><bean></code></strong> tag with the new changed tokens in the properties as shown below:</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[<!-- configure Simple to use custom prefix/suffix tokens --> <bean id="simple" class="org.apache.camel.language.simple.SimpleLanguage"> <property name="functionStartToken" value="["/> <property name="functionEndToken" value="]"/> </bean> ]]></script> -</div></div><p>In the example above we use <strong><code>[]</code></strong> as the changed tokens. Notice by changing the start/end token you change those in all the Camel applications which share the same <strong><code>camel-core</code></strong> on their classpath. For example in an OSGi server this may affect many applications, where as a Web Application as a WAR file it only affects the Web Application.</p><h3 id="BookInOnePage-LoadingScriptfromExternalResource">Loading Script from External Resource</h3><p><strong>Available as of Camel 2.11</strong></p><p>You can externalize the script and have Camel load it from a resource such as: <code><strong>classpath:</strong></code>, <code><strong>file:</strong></code>, or <code><strong>http:</strong></code>. This is done using the following syntax: <code><strong>resource:scheme:location</strong></code>, e.g., to refer to a file on the classpath you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="cod eContent panelContent pdl"> +</div></div><p>In the example above we use <strong><code>[]</code></strong> as the changed tokens. Notice by changing the start/end token you change those in all the Camel applications which share the same <strong><code>camel-core</code></strong> on their classpath. For example in an OSGi server this may affect many applications, where as a Web Application as a WAR file it only affects the Web Application.</p><h3 id="BookInOnePage-LoadingScriptfromExternalResource">Loading Script from External Resource</h3><p><strong>Available <strong>from</strong> Camel 2.11</strong></p><p>You can externalize the script and have Camel load it from a resource such as: <code><strong>classpath:</strong></code>, <code><strong>file:</strong></code>, or <code><strong>http:</strong></code>. This is done using the following syntax: <code><strong>resource:scheme:location</strong></code>, e.g., to refer to a file on the classpath you can do:</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[.setHeader("myHeader").simple("resource:classpath:mysimple.txt") ]]></script> -</div></div><h3 id="BookInOnePage-SettingSpringbeanstoExchangeproperties">Setting Spring beans to Exchange properties</h3><p><strong>Available as of Camel 2.6</strong></p><p>You can set a spring bean into an exchange property as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookInOnePage-SettingSpringbeanstoExchangeproperties">Setting Spring beans to Exchange properties</h3><p><strong>Available <strong>from</strong> Camel 2.6</strong></p><p>You can set a spring bean into an exchange property as shown below:</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[<bean id="myBeanId" class="my.package.MyCustomClass"/> <route> @@ -16871,11 +16871,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.rbtoc1498778285286 {padding: 0px;} -div.rbtoc1498778285286 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1498778285286 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1498782583815 {padding: 0px;} +div.rbtoc1498782583815 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1498782583815 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1498778285286"> +/*]]>*/</style></p><div class="toc-macro rbtoc1498782583815"> <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/book-languages-appendix.html ============================================================================== --- websites/production/camel/content/book-languages-appendix.html (original) +++ websites/production/camel/content/book-languages-appendix.html Fri Jun 30 00:37:20 2017 @@ -952,7 +952,7 @@ simple("There are ${body.length} li </div></div><h3 id="BookLanguagesAppendix-OperatorSupport">Operator Support</h3><p>The parser is limited to only support a single operator. To enable it the left value must be enclosed in <strong><code>${}</code></strong>.</p><p>The syntax is:</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[${leftValue} OP rightValue ]]></script> -</div></div><p>Where the <strong><code>rightValue</code></strong> can be a <strong><code>String</code></strong> literal enclosed in <strong><code>' '</code></strong>, <strong><code>null</code></strong>, a constant value or another expression enclosed in<strong><code> ${}</code></strong>.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>There <em><strong>must</strong></em> be spaces around the operator.</p></div></div><p>Camel will automatically type convert the <strong><code>rightValue</code></strong> type to the <strong><code>leftValue</code></strong> type, so it is possible to for example, convert a string into a numeric so you can use <strong><code>></code></strong> comparison for numeric values.</p><p>The following operators are support ed:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>==</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>=~</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> equals ignore case (will ignore case when comparing <strong><code>String</code></strong> values).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>>=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than or equals.</p></td></tr><tr><td colspan ="1" rowspan="1" class="confluenceTd"><p><code><</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code><=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than or equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>!=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Not equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if not contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>regex</code></p></td><td colspan="1" rowspan="1" class="co nfluenceTd"><p>For matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not regex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For not matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma, eg ',,bronze,silver,gold', which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matchi ng if not in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma. Example: <strong><code>',,bronze,silver,gold'</code></strong>, which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is not an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is not within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>starts with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17.1, 2.18</strong><span>: For testing if the left hand side string starts with the right hand string.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ends with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Ca mel 2.17.1, 2.18</strong>: For testing if the left hand side string ends with the right hand string.</p></td></tr></tbody></table></div><p>And the following unary operators can be used:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>++</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To increment a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>--</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To decrement a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">< p><code>\</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.3 to 2.10.x</strong> To escape a value, e.g., <strong><code>\$</code></strong>, to indicate a <strong><code>$</code></strong> sign. Special: Use <strong><code>\n</code></strong> for new line, <strong><code>\t</code></strong> for tab, and <strong><code>\r</code></strong> for carriage return.</p><p><strong>Note:</strong> Escaping is <strong>not</strong> supported using the <a shape="rect" href="file-language.html"><span style="color: rgb(0,0,0);">File Language</span></a><span style="color: rgb(0,0,0);">.</span></p><p><strong>Note:</strong> from Camel 2.11, <em>the escape character is no longer supported</em>. It has been replaced with the following three escape sequences.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\n</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use newline character.</p> </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\t</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use tab character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\r</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use carriage return character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\</code>}</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.18:</strong> To use the <strong><code>}</code></strong> character as text.</p></td></tr></tbody></table></div><p>And the following logical operators can be used to group expressions:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>and</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>&&</code></strong> instead. The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>or</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>||</code></strong> instead. The logical or operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>&&</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>||</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"> <p><strong>Camel 2.9:</strong> The logical or operator is used to group two expressions.</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Using and,or operators</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>In <strong>Camel 2.4 and older</strong> the <strong><code>and</code></strong> or <strong><code>or</code></strong> can only be used <strong>once</strong> in a simple language expression. From <strong>Camel 2.5</strong>: you can use these operators multiple times.</p></div></div><p>The syntax for <strong><code>AND</code></strong> is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Where the <strong><code>rightValue</code></strong> can be a <strong><code>String</code></strong> literal enclosed in <strong><code>' '</code></strong>, <strong><code>null</code></strong>, a constant value or another expression enclosed in<strong><code> ${}</code></strong>.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Important</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>There <em><strong>must</strong></em> be spaces around the operator.</p></div></div><p>Camel will automatically type convert the <strong><code>rightValue</code></strong> type to the <strong><code>leftValue</code></strong> type, so it is possible to for example, convert a string into a numeric so you can use <strong><code>></code></strong> comparison for numeric values.</p><p>The following operators are support ed:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>==</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>=~</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> equals ignore case (will ignore case when comparing <strong><code>String</code></strong> values).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>>=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Greater than or equals.</p></td></tr><tr><td colspan ="1" rowspan="1" class="confluenceTd"><p><code><</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code><=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Less than or equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>!=</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Not equals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not contains</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For testing if not contains in a string based value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>regex</code></p></td><td colspan="1" rowspan="1" class="co nfluenceTd"><p>For matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not regex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For not matching against a given regular expression pattern defined as a <strong><code>String</code></strong> value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma, eg ',,bronze,silver,gold', which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not in</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matchi ng if not in a set of values, each element must be separated by comma.</p><p>If you want to include an empty value, then it must be defined using double comma. Example: <strong><code>',,bronze,silver,gold'</code></strong>, which<br clear="none">is a set of four values with an empty value and then the three medals.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not is</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is not an <strong><code>instanceof</code></strong> the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>not range</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side is not within a range of values defined as numbers: <strong><code>from..to</code></strong>.</p><p>From <strong>Camel 2.9</strong>: the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>starts with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17.1, 2.18</strong><span>: For testing if the left hand side string starts with the right hand string.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ends with</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Ca mel 2.17.1, 2.18</strong>: For testing if the left hand side string ends with the right hand string.</p></td></tr></tbody></table></div><p>And the following unary operators can be used:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>++</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To increment a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>--</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> To decrement a number by one. The left hand side must be a function, otherwise parsed as literal.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">< p><code>\</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.3 to 2.10.x</strong> To escape a value, e.g., <strong><code>\$</code></strong>, to indicate a <strong><code>$</code></strong> sign. Special: Use <strong><code>\n</code></strong> for new line, <strong><code>\t</code></strong> for tab, and <strong><code>\r</code></strong> for carriage return.</p><p><strong>Note:</strong> Escaping is <strong>not</strong> supported using the <a shape="rect" href="file-language.html"><span style="color: rgb(0,0,0);">File Language</span></a><span style="color: rgb(0,0,0);">.</span></p><p><strong>Note:</strong> from Camel 2.11, <em>the escape character is no longer supported</em>. It has been replaced with the following three escape sequences.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\n</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use newline character.</p> </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\t</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use tab character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\r</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To use carriage return character.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>\</code>}</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.18:</strong> To use the <strong><code>}</code></strong> character as text.</p></td></tr></tbody></table></div><p>And the following logical operators can be used to group expressions:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Operator</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>and</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>&&</code></strong> instead. The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>or</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><strong>Deprecated</strong></span>: use <strong><code>||</code></strong> instead. The logical or operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>&&</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>||</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"> <p><strong>Camel 2.9:</strong> The logical or operator is used to group two expressions.</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Using and,or operators</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>In <strong>Camel 2.4 and older</strong> the <strong><code>and</code></strong> or <strong><code>or</code></strong> can only be used <strong>once</strong> in a simple language expression.</p><p>From <strong>Camel 2.5</strong>: you can use these operators multiple times.</p></div></div><p>The syntax for <strong><code>AND</code></strong> is:</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[${leftValue} OP rightValue and ${leftValue} OP rightValue ]]></script> </div></div><p>And the syntax for <strong><code>OR</code></strong> is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -1009,7 +1009,7 @@ simple("${in.header.type} == ${bean </div></div><p>Ranges are also supported. The range interval requires numbers and both from and end are inclusive. For instance to test whether a value is between <strong><code>100</code></strong> and <strong><code>199</code>:</strong></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[simple("${in.header.number} range 100..199") ]]></script> -</div></div><p>Notice we use <strong><code>..</code></strong> in the range without spaces. It is based on the same syntax as Groovy.</p><p>From <strong>Camel 2.9</strong> onwards the range value must be in single quotes:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Notice we use <strong><code>..</code></strong> in the range without spaces. It is based on the same syntax as Groovy.</p><p>From <strong>Camel 2.9</strong>: the range value must be in single quotes:</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[simple("${in.header.number} range '100..199'") ]]></script> </div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Can be used in Spring XML</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As the Spring XML does not have all the power as the Java DSL with all its various builder methods, you have to resort to use some other languages for testing with simple operators. Now you can do this with the simple language. In the sample below we want to test if the header is a widget order:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -1057,7 +1057,7 @@ simple("${in.header.type} == ${bean .transform().simple("OrderId: ${bean:orderIdGenerator}") .to("mock:reply"); ]]></script> -</div></div><p>Where <code>orderIdGenerator</code> is the id of the bean registered in the <a shape="rect" href="registry.html">Registry</a>. If using Spring then it is the Spring bean id.</p><p>If we want to declare which method to invoke on the order id generator bean we must prepend <strong><code>.method name</code></strong> such as below where we invoke the <code>generateId</code> method.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Where <strong><code>orderIdGenerator</code></strong> is the id of the bean registered in the <a shape="rect" href="registry.html">Registry</a>. If using Spring then it is the Spring bean id.</p><p>If we want to declare which method to invoke on the order id generator bean we must prepend <strong><code>.method name</code></strong> such as below where we invoke the <strong><code>generateId</code></strong> method.</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:order") .transform().simple("OrderId: ${bean:orderIdGenerator.generateId}") .to("mock:reply"); @@ -1067,7 +1067,7 @@ simple("${in.header.type} == ${bean .transform().simple("OrderId: ${bean:orderIdGenerator?method=generateId}") .to("mock:reply"); ]]></script> -</div></div><p>And from Camel 2.3 you can also convert the body to a given type, for example to ensure that it is a <strong><code>String</code></strong> you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>From <strong>Camel 2.3</strong>: you can also convert the body to a given type, for example to ensure that it is a <strong><code>String</code></strong> you can do:</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[<transform> <simple>Hello ${bodyAs(String)} how are you?</simple> </transform> @@ -1077,12 +1077,12 @@ simple("${in.header.type} == ${bean <simple>The gold value is ${header.type[gold]}</simple> </transform> ]]></script> -</div></div><p>In the code above we lookup the header with name <code>type</code> and regard it as a <strong><code>java.util.Map</code></strong> and we then lookup with the key <strong><code>gold</code></strong> and return the value. If the header is not convertible to Map an exception is thrown. If the header with name <strong><code>type</code></strong> does not exist <strong><code>null</code></strong> is returned.</p><p>From Camel 2.9 you can nest functions, such as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>In the code above we lookup the header with name <code>type</code> and regard it as a <strong><code>java.util.Map</code></strong> and we then lookup with the key <strong><code>gold</code></strong> and return the value. If the header is not convertible to Map an exception is thrown. If the header with name <strong><code>type</code></strong> does not exist <strong><code>null</code></strong> is returned.</p><p>From <strong>Camel 2.9</strong>: you can nest functions, such as shown below:</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[<setHeader headerName="myHeader"> <simple>${properties:${header.someKey}}</simple> </setHeader> ]]></script> -</div></div><h4 id="BookLanguagesAppendix-ReferringtoConstantsorEnums">Referring to Constants or Enums</h4><p><strong>Available as of Camel 2.11</strong></p><p>Suppose you have an enum for customers</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h4 id="BookLanguagesAppendix-ReferringtoConstantsorEnums">Referring to Constants or Enums</h4><p><strong>Available <strong>from</strong> Camel 2.11</strong></p><p>Suppose you have an enum for customers:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ public enum Customer { @@ -1100,17 +1100,17 @@ from("direct:start") .otherwise() .to("mock:other"); ]]></script> -</div></div><h3 id="BookLanguagesAppendix-UsingNewLinesorTabsinXMLDSLs">Using New Lines or Tabs in XML DSLs</h3><p><strong>Available as of Camel 2.9.3</strong></p><p>From <strong>Camel 2.9.3</strong>, it is easier to specify new lines or tabs in XML DSLs as you can escape the value now</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookLanguagesAppendix-UsingNewLinesorTabsinXMLDSLs">Using New Lines or Tabs in XML DSLs</h3><p><strong>Available <strong>from</strong> Camel 2.9.3</strong></p><p>From <strong>Camel 2.9.3</strong>: it is easier to specify new lines or tabs in XML DSLs as you can escape the value now</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[<transform> <simple>The following text\nis on a new line</simple> </transform> ]]></script> -</div></div><h3 id="BookLanguagesAppendix-LeadingandTrailingWhitespaceHandling">Leading and Trailing Whitespace Handling</h3><p><strong>Available as of Camel 2.10.0</strong></p><p>From <strong>Camel 2.10.0</strong>, the <strong><code>trim</code></strong> attribute of the expression can be used to control whether the leading and trailing whitespace characters are removed or preserved. The default of <strong><code>trim=true</code></strong> removes all whitespace characters.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookLanguagesAppendix-LeadingandTrailingWhitespaceHandling">Leading and Trailing Whitespace Handling</h3><p><strong>Available <strong>from</strong> Camel 2.10.0</strong></p><p>From <strong>Camel 2.10.0</strong>: the <strong><code>trim</code></strong> attribute of the expression can be used to control whether the leading and trailing whitespace characters are removed or preserved. The default of <strong><code>trim=true</code></strong> removes all whitespace characters.</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[<setBody> <simple trim="false">You get some trailing whitespace characters. </simple> </setBody> ]]></script> -</div></div><h3 id="BookLanguagesAppendix-SettingtheResultType">Setting the Result Type</h3><p><strong>Available as of Camel 2.8</strong></p><p>You can now provide a result type to the <a shape="rect" href="simple.html">Simple</a> expression, which means the result of the evaluation will be converted to the desired type. This is most usable to define types such as <code>boolean</code>'s, <code>integer</code>'s, etc.</p><p>For example to set a header as a <strong><code>boolean</code></strong> type you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookLanguagesAppendix-SettingtheResultType">Setting the Result Type</h3><p><strong>Available from Camel 2.8</strong></p><p>You can now provide a result type to the <a shape="rect" href="simple.html">Simple</a> expression, which means the result of the evaluation will be converted to the desired type. This is most usable to define types such as <code>boolean</code>'s, <code>integer</code>'s, etc.</p><p>For example to set a header as a <strong><code>boolean</code></strong> type you can do:</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[.setHeader("cool", simple("true", Boolean.class)) ]]></script> </div></div><p>And in XML DSL</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -1119,17 +1119,17 @@ from("direct:start") <simple resultType="java.lang.Boolean">true</simple> </setHeader> ]]></script> -</div></div><h3 id="BookLanguagesAppendix-ChangingFunctionStartandEndTokens">Changing Function Start and End Tokens</h3><p><strong>Available as of Camel 2.9.1</strong></p><p>You can configure the function start and end tokens - <strong><code>${}</code></strong> using the setters <strong><code>changeFunctionStartToken</code></strong> and <strong><code>changeFunctionEndToken</code></strong> on <strong><code>SimpleLanguage</code></strong>, using Java code. From Spring XML you can define a <strong><code><bean></code></strong> tag with the new changed tokens in the properties as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookLanguagesAppendix-ChangingFunctionStartandEndTokens">Changing Function Start and End Tokens</h3><p><strong>Available <strong>from</strong> Camel 2.9.1</strong></p><p>You can configure the function start and end tokens - <strong><code>${}</code></strong> using the setters <strong><code>changeFunctionStartToken</code></strong> and <strong><code>changeFunctionEndToken</code></strong> on <strong><code>SimpleLanguage</code></strong>, using Java code. From Spring XML you can define a <strong><code><bean></code></strong> tag with the new changed tokens in the properties as shown below:</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[<!-- configure Simple to use custom prefix/suffix tokens --> <bean id="simple" class="org.apache.camel.language.simple.SimpleLanguage"> <property name="functionStartToken" value="["/> <property name="functionEndToken" value="]"/> </bean> ]]></script> -</div></div><p>In the example above we use <strong><code>[]</code></strong> as the changed tokens. Notice by changing the start/end token you change those in all the Camel applications which share the same <strong><code>camel-core</code></strong> on their classpath. For example in an OSGi server this may affect many applications, where as a Web Application as a WAR file it only affects the Web Application.</p><h3 id="BookLanguagesAppendix-LoadingScriptfromExternalResource">Loading Script from External Resource</h3><p><strong>Available as of Camel 2.11</strong></p><p>You can externalize the script and have Camel load it from a resource such as: <code><strong>classpath:</strong></code>, <code><strong>file:</strong></code>, or <code><strong>http:</strong></code>. This is done using the following syntax: <code><strong>resource:scheme:location</strong></code>, e.g., to refer to a file on the classpath you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div cl ass="codeContent panelContent pdl"> +</div></div><p>In the example above we use <strong><code>[]</code></strong> as the changed tokens. Notice by changing the start/end token you change those in all the Camel applications which share the same <strong><code>camel-core</code></strong> on their classpath. For example in an OSGi server this may affect many applications, where as a Web Application as a WAR file it only affects the Web Application.</p><h3 id="BookLanguagesAppendix-LoadingScriptfromExternalResource">Loading Script from External Resource</h3><p><strong>Available <strong>from</strong> Camel 2.11</strong></p><p>You can externalize the script and have Camel load it from a resource such as: <code><strong>classpath:</strong></code>, <code><strong>file:</strong></code>, or <code><strong>http:</strong></code>. This is done using the following syntax: <code><strong>resource:scheme:location</strong></code>, e.g., to refer to a file on the classpath you can do:</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[.setHeader("myHeader").simple("resource:classpath:mysimple.txt") ]]></script> -</div></div><h3 id="BookLanguagesAppendix-SettingSpringbeanstoExchangeproperties">Setting Spring beans to Exchange properties</h3><p><strong>Available as of Camel 2.6</strong></p><p>You can set a spring bean into an exchange property as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="BookLanguagesAppendix-SettingSpringbeanstoExchangeproperties">Setting Spring beans to Exchange properties</h3><p><strong>Available <strong>from</strong> Camel 2.6</strong></p><p>You can set a spring bean into an exchange property as shown below:</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[<bean id="myBeanId" class="my.package.MyCustomClass"/> <route> Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available.