Modified: websites/production/camel/content/simple.html ============================================================================== --- websites/production/camel/content/simple.html (original) +++ websites/production/camel/content/simple.html Fri Oct 14 20:20:46 2016 @@ -86,33 +86,34 @@ <tbody> <tr> <td valign="top" width="100%"> -<div class="wiki-content maincontent"><h2 id="Simple-SimpleExpressionLanguage">Simple Expression Language</h2><p>The Simple Expression Language was a really simple language when it was created, but has since grown more powerful. It is primarily intended for being a really small and simple language for evaluating <a shape="rect" href="expression.html">Expression</a>s and <a shape="rect" href="predicate.html">Predicate</a>s without requiring any new dependencies or knowledge of <a shape="rect" href="xpath.html">XPath</a>; so it is ideal for testing in camel-core. The idea was to cover 95% of the common use cases when you need a little bit of expression based script in your Camel routes.</p><p>However for much more complex use cases you are generally recommended to choose a more expressive and powerful language such as:</p><ul><li><a shape="rect" href="spel.html">SpEL</a></li><li><a shape="rect" href="mvel.html">Mvel</a></li><li><a shape="rect" href="groovy.html">Groovy</a></li><li><a shape="rect" href="javascript.html">JavaScript</a></li><li><a shape="rect" href="el.html">EL</a></li><li><a shape="rect" href="ognl.html">OGNL</a></li><li>one of the supported <a shape="rect" href="scripting-languages.html">Scripting Languages</a></li></ul><p>The simple language uses <code>${body</code>} placeholders for complex expressions where the expression contains constant literals. The ${ } placeholders can be omitted if the expression is only the token itself.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Alternative syntax</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From Camel 2.5 onwards you can also use the alternative syntax which uses $simple{ } as placeholders.<br clear="none"> This can be used in situations to avoid clashes when using for example Spring property placeholder together with Camel.</p></div></div><di v class="confluence-information-macro confluence-information-macro-tip"><p class="title">Configuring result type</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From Camel 2.8 onwards you can configure the result type of the <a shape="rect" href="simple.html">Simple</a> expression. For example to set the type as a <code>java.lang.Boolean</code> or a <code>java.lang.Integer</code> etc.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">File language is now merged with Simple language</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From Camel 2.2 onwards, the <a shape="rect" href="file-language.html">File Language</a> is now merged with <a shape="rect" href="simple.html">Simple</a> language which means you can use all the file syntax directly within the simple language.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Simple Language Changes in Camel 2.9 onwards</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The <a shape="rect" href="simple.html">Simple</a> language have been improved from Camel 2.9 onwards to use a better syntax parser, which can do index precise error messages, so you know exactly what is wrong and where the problem is. For example if you have made a typo in one of the operators, then previously the parser would not be able to detect this, and cause the evaluation to be true. There are a few changes in the syntax which are no longer backwards compatible. When using <a shape="rect" href="simple.html">Simple</a> language as a <a shape="rect" href="predicate.html">Predicate</a> then the literal text <strong>must</s trong> be enclosed in either single or double quotes. For example: <code>"${body} == 'Camel'"</code>. Notice how we have single quotes around the literal. The old style of using <code>"body"</code> and <code>"header.foo"</code> to refer to the message body and header is @deprecated, and it is encouraged to always use ${ } tokens for the built-in functions.<br clear="none"> The range operator now requires the range to be in single quote as well as shown: <code>"${header.zip} between '30000..39999'"</code>.</p></div></div><p>To get the body of the in message: <code>"body"</code>, or <code>"in.body"</code> or <code>"${body}"</code>.</p><p>A complex expression must use ${ } placeholders, such as: <code>"Hello ${in.header.name} how are you?"</code>.</p><p>You can have multiple functions in the same expression: <code>"Hello ${in.header.name} this is ${in.header.me} speaking"</code>.<br clear="none"> However you can <strong>not</strong> nest functions in Camel 2.8.x or older (i.e. having a nother ${ } placeholder in an existing, is not allowed).<br clear="none"> From <strong>Camel 2.9</strong> onwards you can nest functions.</p><h3 id="Simple-Variables">Variables</h3><div class="confluenceTableSmall"><div class="table-wrap"> - <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Variable</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>camelId</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> the <a shape="rect" href="camelcontext.html">CamelContext</a> name</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>camelContext.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> the CamelContext invoked using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">exchange</td><td colspan="1" rowspan="1" class="confluenceTd">Exchange</td ><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> >the <a shape="rect" href="exchange.html">Exchange</a></td></tr><tr><td >colspan="1" rowspan="1" >class="confluenceTd">exchange.<strong>OGNL</strong></td><td colspan="1" >rowspan="1" class="confluenceTd">Object</td><td colspan="1" rowspan="1" >class="confluenceTd"><strong>Camel 2.16:</strong><span> the </span><a >shape="rect" href="exchange.html">Exchange</a><span> invoked using a Camel >OGNL expression.</span></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p>exchangeId</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p><strong>Camel 2.3:</strong> the exchange >id</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p>id</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p>the input message id</p></td></tr><tr><td colspan="1" >rowspan="1 " class="confluenceTd"><p>body</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the input body</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.body</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the input body</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>body.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> the input body invoked using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.body.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> the input body invoked using a Camel OGNL expr ession.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bodyAs(<em>type</em>)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Type</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> Converts the body to the given type determined by its classname. The converted body can be null.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span>bodyAs(</span><em>type</em><span>).<strong>OGNL</strong></span></td><td colspan="1" rowspan="1" class="confluenceTd">Object</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.18:</strong><span> Converts the body to the given type determined by its classname and then invoke methods using a Camel OGNL expression. The converted body can be null.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>mandatoryBodyAs(<em>type</em>)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Type</p></td><td colspan="1" rowspan="1" class="co nfluenceTd"><p><strong>Camel 2.5:</strong> Converts the body to the given type determined by its classname, and expects the body to be not null.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span>mandatoryBodyAs(</span><em>type</em><span>).<strong>OGNL</strong></span></td><td colspan="1" rowspan="1" class="confluenceTd">Object</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.18:</strong><span> Converts the body to the given type determined by its classname and then invoke methods using a Camel OGNL expression.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>out.body</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the output body</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>header.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>header[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>headers.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>headers[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.header.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluen ceTd"><p>refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.header[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.headers.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.headers[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input foo header</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>header.foo[bar]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1 " rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> regard input foo header as a map and perform lookup on the map with bar as key</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.header.foo[bar]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> regard input foo header as a map and perform lookup on the map with bar as key</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.headers.foo[bar]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> regard input foo header as a map and perform lookup on the map with bar as key</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>header.foo.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" cl ass="confluenceTd"><p><strong>Camel 2.3:</strong> refer to the input foo header and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.header.foo.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> refer to the input foo header and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.headers.foo.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> refer to the input foo header and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>out.header.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowsp an="1" class="confluenceTd"><p>refer to the out header foo</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>out.header[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the out header foo</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>out.headers.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>refer to the out header foo</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>out.headers[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the out header foo</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>headerAs(<em>key</em>,<em>type</em>)</p></td><td colspan="1" rowspan="1" class="confluen ceTd"><p>Type</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> Converts the header to the given type determined by its classname</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>headers</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Map</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> refer to the input headers</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in.headers</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Map</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> refer to the input headers</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>property.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated:</strong> refer to the foo property on the exchange</p></td></tr><tr><td colspan="1" r owspan="1" class="confluenceTd">exchangeProperty.foo</td><td colspan="1" rowspan="1" class="confluenceTd">Object</td><td colspan="1" rowspan="1" class="confluenceTd"><span><strong>Camel 2.15:</strong> refer to the foo property on the exchange</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>property[foo]</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated:</strong> refer to the foo property on the exchange</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span>exchangeProperty[foo]</span></td><td colspan="1" rowspan="1" class="confluenceTd">Object</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15:</strong><span> refer to the foo property on the exchange</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>property.foo.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></ td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated:</strong> refer to the foo property on the exchange and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span>exchangeProperty.foo.</span><strong>OGNL</strong></td><td colspan="1" rowspan="1" class="confluenceTd">Object</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.15:</strong><span> refer to the foo property on the exchange and invoke its value using a Camel OGNL expression.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>sys.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>refer to the system property</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>sysenv.foo</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Came l 2.3:</strong> refer to the system environment</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>exception</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> Refer to the exception object on the exchange, is <strong>null</strong> if no exception set on exchange. Will fallback and grab caught exceptions (<code>Exchange.EXCEPTION_CAUGHT</code>) if the Exchange has any.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>exception.<strong>OGNL</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> Refer to the exchange exception invoked using a Camel OGNL expression object</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>exception.message</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td cols pan="1" rowspan="1" class="confluenceTd"><p>Refer to the exception.message on the exchange, is <strong>null</strong> if no exception set on exchange. Will fallback and grab caught exceptions (<code>Exchange.EXCEPTION_CAUGHT</code>) if the Exchange has any.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>exception.stacktrace</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.6.</strong> Refer to the exception.stracktrace on the exchange, is <strong>null</strong> if no exception set on exchange. Will fallback and grab caught exceptions (<code>Exchange.EXCEPTION_CAUGHT</code>) if the Exchange has any.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>date:<em>command:pattern</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Date formatting using the <code>java.text.SimpleDate Format</code> patterns. Supported commands are: <strong>now</strong> for current timestamp, <strong>in.header.xxx</strong> or <strong>header.xxx</strong> to use the Date object in the IN header with the key xxx. <strong>out.header.xxx</strong> to use the Date object in the OUT header with the key xxx.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>bean:<em>bean expression</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Invoking a bean expression using the <a shape="rect" href="bean.html">Bean</a> language. Specifying a method name you must use dot as separator. We also support the ?method=methodname syntax that is used by the <a shape="rect" href="bean.html">Bean</a> component.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>properties:<em>locations:key</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1 " class="confluenceTd"><p><strong>Deprecated (use properties-location instead) Camel 2.3:</strong> Lookup a property with the given key. The <code>locations</code> option is optional. See more at <a shape="rect" href="using-propertyplaceholder.html">Using PropertyPlaceholder</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>properties-location:<em><a shape="rect" class="external-link" href="http://locationskey" rel="nofollow">locations:key</a></em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.14.1:</strong> Lookup a property with the given key. The <code>locations</code> option is optional. See more at <a shape="rect" href="using-propertyplaceholder.html">Using PropertyPlaceholder</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">properties:key:default</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.14.1</strong>: Lookup a property with the given key. If the key does not exists or has no value, then an optional default value can be specified.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>routeId</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> Returns the id of the current route the <a shape="rect" href="exchange.html">Exchange</a> is being routed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>threadName</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> Returns the name of the current thread. Can be used for logging purpose.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>ref:xxx</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" r owspan="1" class="confluenceTd"><p><strong>Camel 2.6:</strong> To lookup a bean from the <a shape="rect" href="registry.html">Registry</a> with the given id.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>type:name.field</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Object</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To refer to a type or field by its FQN name. To refer to a field you can append .FIELD_NAME. For example you can refer to the constant field from Exchange as: <code>org.apache.camel.Exchange.FILE_NAME</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>null</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12.3:</strong> represents a <strong>null</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceT d"><p>random<em>(value)</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Integer</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16.0: </strong>returns a random Integer between 0 (included) and <em>value</em> (excluded)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>random<em>(min,max)</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Integer</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16.0: </strong>returns a random Integer between <em>min</em> (included) and <em>max</em> (excluded)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">collate(group)</td><td colspan="1" rowspan="1" class="confluenceTd">List</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> The collate function iterates the message body and groups the data into sub lists of specified size. This can be used with the <a shape="rect" href="splitter.html">Splitter</ a> EIP to split a message body and group/batch the splitted sub message into a group of N sub lists. This method works similar to the collate method in Groovy.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">messageHistory</td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> The message history of the current exchange how it has been routed. This is similar to the route stack-trace message history the error handler logs in case of an unhandled exception.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><span>messageHistory(false)</span></td><td colspan="1" rowspan="1" class="confluenceTd">String</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong><span> </span>As messageHistory but without the exchange details (only includes the route strack-trace). This can be used if you do not want to log sensitive data from the message itself.</td> </tr></tbody></table> -</div></div><h3 id="Simple-OGNLexpressionsupport">OGNL expression support</h3><p><strong>Available as of Camel 2.3</strong></p><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>Camel's OGNL support is for invoking methods only. You cannot access fields.<br clear="none"> From <strong>Camel 2.11.1</strong> onwards we added special support for accessing the length field of Java arrays.</p></div></div><p>The <a shape="rect" href="simple.html">Simple</a> and <a shape="rect" href="bean.html">Bean</a> language now supports a Camel OGNL notation for invoking beans in a chain like fashion.<br clear="none"> Suppose the Message IN body contains a POJO which has a <code>getAddress()</code> method.</p><p>Then you can use Camel OGNL notation to access the address object:</p><div class="code panel pdl" style="border-widt h: 1px;"><div class="codeContent panelContent pdl"> +<div class="wiki-content maincontent"><h2 id="Simple-SimpleExpressionLanguage">Simple Expression Language</h2><p>The Simple Expression Language was a really simple language when it was created, but has since grown more powerful. It is primarily intended for being a really small and simple language for evaluating <a shape="rect" href="expression.html">Expression</a>s and <a shape="rect" href="predicate.html">Predicate</a>s without requiring any new dependencies or knowledge of <a shape="rect" href="xpath.html">XPath</a>; so it is ideal for testing in <strong><code>camel-core</code></strong>. The idea was to cover 95% of the common use cases when you need a little bit of expression based script in your Camel routes.</p><p>However for much more complex use cases you are generally recommended to choose a more expressive and powerful language such as:</p><ul><li><a shape="rect" href="spel.html">SpEL</a></li><li><a shape="rect" href="mvel.html">Mvel</a></li><li><a shape="rect" href="groov y.html">Groovy</a></li><li><a shape="rect" href="javascript.html">JavaScript</a></li><li><a shape="rect" href="el.html">EL</a></li><li><a shape="rect" href="ognl.html">OGNL</a></li><li>one of the supported <a shape="rect" href="scripting-languages.html">Scripting Languages</a></li></ul><p>The simple language uses <strong><code>${body</code>}</strong> placeholders for complex expressions where the expression contains constant literals. The <strong><code>${ }</code></strong> placeholders can be omitted if the expression is only the token itself.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Alternative syntax</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From Camel 2.5 you can also use the alternative syntax which uses <strong><code>$simple{ }</code></strong> as placeholders. This can be used in situations to avoid clashe s when using for example Spring property placeholder together with Camel.</p></div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Configuring result type</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From Camel 2.8 you can configure the result type of the <a shape="rect" href="simple.html">Simple</a> expression. For example to set the type as a <strong><code>java.lang.Boolean</code></strong> or a <code>j<strong>ava.lang.Integer</strong></code> etc.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">File language is now merged with Simple language</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From Camel 2.2, the <a shape="rect" href="file-language.html">File Langu age</a> is now merged with <a shape="rect" href="simple.html">Simple</a> language which means you can use all the file syntax directly within the simple language.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Simple Language Changes in Camel 2.9 onwards</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The <a shape="rect" href="simple.html">Simple</a> language have been improved from Camel 2.9 to use a better syntax parser, which can do index precise error messages, so you know exactly what is wrong and where the problem is. For example if you have made a typo in one of the operators, then previously the parser would not be able to detect this, and cause the evaluation to be true. There are a few changes in the syntax which are no longer backwards compatible. When using <a shape="rect" href="simple.html">Simple</a> l anguage as a <a shape="rect" href="predicate.html">Predicate</a> then the literal text <strong>must</strong> be enclosed in either single or double quotes. For example: <code>"<strong>${body} == 'Camel'</strong>"</code>. Notice how we have single quotes around the literal. The old style of using <code>"<strong>body</strong>"</code> and <code>"<strong>header.foo</strong>"</code> to refer to the message body and header is <strong><code>@deprecated</code></strong>, and it is encouraged to always use <strong><code>${ }</code></strong> tokens for the built-in functions.<br clear="none"> The range operator now requires the range to be in single quote as well as shown: <code>"<strong>${header.zip} between '30000..39999'</strong>"</code>.</p></div></div><p>To get the body of the in message: <strong><code>body</code></strong>, or <strong><code>in.body</code></strong> or <strong><code>${body}</code></strong>.</p><p>A complex expression must use <strong><code>${ }</code></strong> pla ceholders, such as: <strong><code>Hello ${in.header.name} how are you?</code></strong>.</p><p>You can have multiple functions in the same expression: <code>"<strong>Hello ${in.header.name} this is ${in.header.me} speaking</strong>"</code>. However you can <em><strong>not</strong></em> nest functions in Camel 2.8.x or older e.g., having another <strong><code>${ }</code></strong> placeholder in an existing, is not allowed. From <strong>Camel 2.9</strong> you can nest functions.</p><h3 id="Simple-Variables">Variables</h3><div class="confluenceTableSmall"><div class="table-wrap"> + <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Variable</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camelId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> the <a shape="rect" href="camelcontext.html">CamelContext</a> name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camelContext.<strong>OGNL</strong></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> the <strong><code>CamelContext</code></strong> invoked using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class=" confluenceTd"><p><code>exchange</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Exchange</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> the <a shape="rect" href="exchange.html">Exchange.</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exchange.<strong>OGNL</strong></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong><span> the </span><a shape="rect" href="exchange.html">Exchange</a><span> invoked using a Camel OGNL expression.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> the exchange Id.</p></td></tr><tr><td colspan="1" rowspan="1" class="c onfluenceTd"><p><code>id</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The input message Id.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The input body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The input body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>body.<strong>OGNL</strong></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> the input body invoked using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.body.<strong>OGNL</strong></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> the input body invoked using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bodyAs(<em>type</em>)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Type</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> Converts the body to the given type determined by its classname. The converted body can be <strong><code>null</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bodyAs(<em>type</em>).<strong>OGNL</strong></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class=" confluenceTd"><p><strong>Camel 2.18:</strong><span> Converts the body to the given type determined by its classname and then invoke methods using a Camel OGNL expression. The converted body can be <strong><code>null</code></strong>.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mandatoryBodyAs(<em>type</em>)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Type</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> Converts the body to the given type determined by its classname, and expects the body to be not <strong><code>null</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mandatoryBodyAs(<em>type</em>).<strong>OGNL</strong></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.18:</strong><span> Converts the body to the given type determined by its classname and then invoke methods using a Camel OGNL expression.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out.body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The output body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>header.<em>foo</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Refer to the input <strong><code>foo</code></strong> header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>header[<em>foo</em>]</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input <strong><code>foo</code></strong> header.</p></td></tr ><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>headers.<em>foo</em></code></p></td><td >colspan="1" rowspan="1" >class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p>Refer to the >input <strong><code>foo</code></strong> header.</p></td></tr><tr><td >colspan="1" rowspan="1" >class="confluenceTd"><p><code>headers[<em>foo</em>]</code></p></td><td >colspan="1" rowspan="1" >class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to >the input <strong><code>foo</code></strong> header.</p></td></tr><tr><td >colspan="1" rowspan="1" >class="confluenceTd"><p><code>in.header.<code><em>foo</em></code></code></p></td><td > colspan="1" rowspan="1" >class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p>Refer to the >input <strong><code>foo</code></strong> header.</p></td></tr><tr><td >colspan="1" row span="1" class="confluenceTd"><p><code>in.header[<code><em>foo</em></code>]</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input <strong><code>foo</code></strong> header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.headers.<code><em>foo</em></code></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Refer to the input <strong><code>foo</code></strong> header.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.headers[<code><em>foo</em></code>]</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the input <strong><code>foo</code></strong> heade r.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>header.foo[<em>bar</em>]</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> regard input <strong><code>foo</code></strong> header as a map and perform lookup on the map with <strong><code>bar</code></strong> as key.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.header.foo[<code><em>bar</em></code>]</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> regard input <strong><code>foo</code></strong> header as a map and perform lookup on the map with <strong><code>bar</code></strong> as key.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.headers.foo[<code><em>bar</em></code>]</code></p>< /td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> regard input <strong><code>foo</code></strong> header as a map and perform lookup on the map with <strong><code>bar</code></strong> as key.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>header.<code><em>foo</em></code>.OGNL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> refer to the input <strong><code>foo</code></strong> header and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.header.<code><em>foo</em></code>.OGNL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2 .3:</strong> refer to the input <strong><code>foo</code></strong> header and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.headers.<code><em>foo</em></code>.OGNL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> refer to the input <strong><code>foo</code></strong> header and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out.header.<code><em>foo</em></code></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Refer to the out header <strong><code>foo</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out.header[<code><em>foo</em></code>]</code></p></td><td colspan= "1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the out header <strong><code>foo</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out.headers.<code><em>foo</em></code></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Refer to the out header <strong><code>foo</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>out.headers[<code><em>foo</em></code>]</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.2:</strong> refer to the out header <strong><code>foo</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>headerAs(<em>key</em>,<em>type</em>)</code>< /p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Type</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.5:</strong> Converts the header to the given type determined by its classname.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>headers</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Map</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> refer to the input headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>in.headers</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Map</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> refer to the input headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>property.<code><em>foo</em></code></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code ></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong><span >style="color: rgb(255,0,0);">Deprecated</span>:</strong> refer to >the <strong><code>foo</code></strong> property on the >exchange.</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>exchangeProperty.<code><em>foo</em></code></code></p></td><td > colspan="1" rowspan="1" >class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><span><strong>Camel 2.15:</strong> refer >to the <strong><code>foo</code></strong> property on the >exchange.</span></p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>property[<code><em>foo</em></code>]</code></p></td><td > colspan="1" rowspan="1" >class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><strong>Deprecated:</strong> refer to >the <strong><code>foo</code></strong> property on the >exchange.</p></td></tr><tr><td colspan="1" row span="1" class="confluenceTd"><p><span><code>exchangeProperty[<code><em>foo</em></code>]</code></span></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.15:</strong><span> refer to the <strong><code>foo</code></strong> property on the exchange.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>property.<code><em>foo</em></code>.OGNL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated:</strong> refer to the <strong><code>foo</code></strong> property on the exchange and invoke its value using a Camel OGNL expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exchangeProperty.<code><em>foo</em></code>.OGNL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p>< /td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.15:</strong><span> refer to the <strong><code>foo</code></strong> property on the exchange and invoke its value using a Camel OGNL expression.</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sys.<code><em>foo</em></code></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Refer to the system property <span><strong><code>foo</code></strong></span>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sysenv.<code><em>foo</em></code></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> refer to the system environment property <span><strong><code>foo</code></strong></span>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>exception</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> Refer to the exception object on the exchange, is <strong><code>null</code></strong> if no exception set on exchange. Will fallback and grab caught exceptions (<strong><code>Exchange.EXCEPTION_CAUGHT</code></strong>) if the Exchange has any.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exception.OGNL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> Refer to the exchange exception invoked using a Camel OGNL expression object</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exception.message</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class= "confluenceTd"><p>Refer to the exception.message on the exchange, is <strong>null</strong> if no exception set on exchange. Will fallback and grab caught exceptions (<strong><code>Exchange.EXCEPTION_CAUGHT</code></strong>) if the Exchange has any.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exception.stacktrace</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.6.</strong> Refer to the <strong><code>exception.stracktrace</code></strong> on the exchange. Result is <strong><code>null</code></strong> if no exception set on exchange. Will fallback and grab caught exceptions (<strong><code>Exchange.EXCEPTION_CAUGHT</code></strong>) if the Exchange has any.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>date:<em>command</em>:<em>pattern</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><co de>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Date formatting using the <strong><code>java.text.SimpleDateFormat</code></strong> patterns. Supported commands are: </p> + <ul><li><p><strong><code>now</code></strong> for current timestamp.</p></li><li><p><strong><code>in.header.xxx</code></strong> or <strong><code>header.xxx</code></strong> to use the <strong><code>Date</code></strong> object in the <strong><code>IN</code></strong> header with the key <strong><code>xxx</code></strong>.</p></li><li><p><strong><code>out.header.xxx</code></strong> to use the <strong><code>Date</code></strong> object in the <strong><code>OUT</code></strong> header with the key <strong><code>xxx</code></strong>.</p></li></ul></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>bean:<em>bean expression</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Invoking a bean expression using the <a shape="rect" href="bean.html">Bean</a> language. Specifying a method name you must use dot as separator. We also support the <strong ><code>?method=methodname</code></strong> syntax that is used by the <a >shape="rect" href="bean.html">Bean</a> component.</p></td></tr><tr><td >colspan="1" rowspan="1" >class="confluenceTd"><p><code>properties:<em>locations</em>:key</code></p></td><td > colspan="1" rowspan="1" >class="confluenceTd"><p><code>String</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><strong><span style="color: >rgb(255,0,0);">Deprecated</span> (use properties-location instead) Camel >2.3:</strong> Lookup a property with the given key. The ><strong><code>locations</code></strong> option is optional. See more at <a >shape="rect" href="using-propertyplaceholder.html">Using >PropertyPlaceholder</a>.</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>properties-location:<em>locations:key</em></code></p></td><td > colspan="1" rowspan="1" >class="confluenceTd"><p><code>String</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><strong>Camel 2.14.1:</strong> Lookup a property with the given key. The <code>locations</code> option is optional. See more at <a shape="rect" href="using-propertyplaceholder.html">Using PropertyPlaceholder</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>properties:key:default</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.14.1</strong>: Lookup a property with the given key. If the key does not exists or has no value, then an optional default value can be specified.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>routeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> Returns the Id of the current route the <a shape="rect" href="exchange.html">Exchange</a> is being routed.</p></td></tr><tr><td colspan="1" rowspan="1" class= "confluenceTd"><p><code>threadName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> Returns the name of the current thread. Can be used for logging purpose.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ref:<em>xxx</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.6:</strong> To lookup a bean from the <a shape="rect" href="registry.html">Registry</a> with the given Id.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>type:name.field</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Object</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> To refer to a type or field by its FQN name. To refer to a field you can append <stro ng><code>.FIELD_NAME</code></strong>. For example you can refer to the constant field from Exchange as: <strong><code>org.apache.camel.Exchange.FILE_NAME</code></strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12.3:</strong> represents a <strong><code>null</code>.</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>random(<em>value</em>)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Integer</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16.0: </strong>returns a random Integer between <em><strong><code>0</code></strong></em> (included) and <strong><em>value</em></strong> (excluded)</p></td></tr><tr><td colspan="1" rowspan="1" c lass="confluenceTd"><p><code>random(<em>min</em>,<em>max</em>)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Integer</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16.0: </strong>returns a random Integer between <strong><em>min</em></strong> (included) and <strong><em>max</em></strong> (excluded)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collate(<em>group</em>)</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>List</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17:</strong> The collate function iterates the message body and groups the data into sub lists of specified size. This can be used with the <a shape="rect" href="splitter.html">Splitter</a> EIP to split a message body and group/batch the split sub messages into a group of <strong><code>N</code></strong> sub lists. This method works similar to the collate method in Groo vy.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>messageHistory</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17:</strong> The message history of the current exchange how it has been routed. This is similar to the route stack-trace message history the error handler logs in case of an un-handled exception.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><span><code>messageHistory(false)</code></span></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.17:</strong><span> </span>As <strong><code>messageHistory</code></strong> but without the exchange details (only includes the route strack-trace). This can be used if you do not want to log sensitive data from the message itself.</p></td></tr></tbody></table> +</div></div><h3 id="Simple-OGNLexpressionsupport">OGNL expression support</h3><p><strong>Available as of Camel 2.3</strong></p><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>Camel's OGNL support is for invoking methods only. You cannot access fields.<br clear="none"> From <strong>Camel 2.11.1</strong> onwards we added special support for accessing the length field of Java arrays.</p></div></div><p>The <a shape="rect" href="simple.html">Simple</a> and <a shape="rect" href="bean.html">Bean</a> language now supports a Camel OGNL notation for invoking beans in a chain like fashion. Suppose the Message <strong><code>IN</code></strong> body contains a POJO which has a <strong><code>getAddress()</code></strong> method.</p><p>Then you can use Camel OGNL notation to access the address object:</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("${body.address}") simple("${body.address.street}") simple("${body.address.zip}") ]]></script> -</div></div><p>Camel understands the shorthand names for getters, but you can invoke any method or use the real name such as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Camel understands the shorthand names for accessors, but you can invoke any method or use the real name such as:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[simple("${body.address}") simple("${body.getAddress.getStreet}") simple("${body.address.getZip}") simple("${body.doSomething}") ]]></script> -</div></div><p>You can also use the null safe operator (<code>?.</code>) to avoid NPE if for example the body does NOT have an address</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>You can also use the null safe operator (<strong><code>?.</code></strong>) to avoid NPE if for example the body does <em>not</em> have an address</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("${body?.address?.street}") ]]></script> -</div></div><p>It is also possible to index in <code>Map</code> or <code>List</code> types, so you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>It is also possible to index in <strong><code>Map</code></strong> or <strong><code>List</code></strong> types, so 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[simple("${body[foo].name}") ]]></script> -</div></div><p>To assume the body is <code>Map</code> based and lookup the value with <code>foo</code> as key, and invoke the <code>getName</code> method on that value.</p><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>If the key has space, then you <strong>must</strong> enclose the key with quotes, for example 'foo bar':</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>To assume the body is <strong><code>Map</code></strong> based and lookup the value with <strong><code>foo</code></strong> as key, and invoke the <strong><code>getName</code></strong> method on that value.</p><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>If the key has space, then you <em><strong>must</strong></em> enclose the key with quotes, for example:</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("${body['foo bar'].name}") ]]></script> -</div></div></div></div><p>You can access the <code>Map</code> or <code>List</code> objects directly using their key name (with or without dots) :</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div></div></div><p>You can access the <strong><code>Map</code></strong> or <strong><code>List</code></strong> objects directly using their key name (with or without dots) :</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("${body[foo]}") simple("${body[this.is.foo]}") ]]></script> -</div></div><p>Suppose there was no value with the key <code>foo</code> then you can use the null safe operator to avoid the NPE as shown:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Suppose there was no value with the key <strong><code>foo</code></strong> then you can use the null safe operator to avoid the NPE as shown:</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("${body[foo]?.name}") ]]></script> </div></div><p>You can also access <code>List</code> types, for example to get lines from the address you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -120,10 +121,10 @@ simple("${body[this.is.foo]}") simple("${body.address.lines[1]}") simple("${body.address.lines[2]}") ]]></script> -</div></div><p>There is a special <code>last</code> keyword which can be used to get the last value from a list.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>There is a special <strong><code>last</code></strong> keyword which can be used to get the last value from a list.</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("${body.address.lines[last]}") ]]></script> -</div></div><p>And to get the 2nd last you can subtract a number, so we can use <code>last-1</code> to indicate this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>And to get the 2nd last you can subtract a number, so we can use <strong><code>last-1</code></strong> to indicate this:</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("${body.address.lines[last-1]}") ]]></script> </div></div><p>And the 3rd last is of course:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -132,7 +133,7 @@ simple("${body.address.lines[2]}&qu </div></div><p>And you can call the size method on the list with</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("${body.address.lines.size}") ]]></script> -</div></div><p>From <strong>Camel 2.11.1</strong> onwards we added support for the length field for Java arrays as well, eg:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>From <strong>Camel 2.11.1</strong> we added support for the length field for Java arrays as well, eg:</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[String[] lines = new String[]{"foo", "bar", "cat"}; exchange.getIn().setBody(lines); @@ -141,13 +142,13 @@ simple("There are ${body.length} li </div></div><p>And yes you can combine this with the operator support as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[simple("${body.address.zip} > 1000") ]]></script> -</div></div><h3 id="Simple-Operatorsupport">Operator support</h3><p>The parser is limited to only support a single operator.</p><p>To enable it the left value must be enclosed in ${ }. The syntax is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h3 id="Simple-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 <code>rightValue</code> can be a String literal enclosed in <code>' '</code>, <code>null</code>, a constant value or another expression enclosed in ${ }.</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 <strong>must</strong> be spaces around the operator.</p></div></div><p>Camel will automatically type convert the rightValue type to the leftValue type, so it is able to eg. convert a string into a numeric so you can use > comparison for numeric values.</p><p>The following operators are supported:</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" c lass="confluenceTd"><p>==</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>equals</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">=~</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> equals ignore case (will ignore case when comparing String values)</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>greater than</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>>=</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><</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>less than</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><=</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>!=</p></td><td co lspan="1" rowspan="1" class="confluenceTd"><p>not equals</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>contains</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>not contains</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>regex</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching against a given regular expression pattern defined as a String value</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>not regex</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For not matching against a given regular expression pattern defined as a String value</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>in</p></td><td colspan="1" rowspan="1" class="con fluenceTd"><p>For matching if in a set of values, each element must be separated by comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>not in</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if not in a set of values, each element must be separated by comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>is</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is an instanceof the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>not is</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For matching if the left hand side type is not an instanceof the value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>range</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: <code>from..to</code>. From <strong>Camel 2.9</strong> onwards the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>not range</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: <code>from..to</code>. From <strong>Camel 2.9</strong> onwards the range values must be enclosed in single quotes.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">starts with</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17.1, 2.18</strong><span>: For testing if the left hand side string starts with the right hand string.</span></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">ends with</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17.1, 2.18</strong>: For testing if the left hand side string ends with the right hand string.</td></tr></tbody></table></div><p>And the following unary operators can be used:</p><div class="table-wrap"><ta ble 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>++</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>--</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>\</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.3 to 2.10.x</strong> To escape a value, eg \$, to indicate a $ sign. Special: Use \n for new line, \t for tab, and \r for carriage return. <strong>Notice:</stro ng> Escaping is <strong>not</strong> supported using the <a shape="rect" href="file-language.html">File Language</a>. <strong>Notice:</strong> From Camel 2.11 onwards the escape character is no longer support, but replaced with the following three special escaping.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>\n</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>\t</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>\r</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">\}</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.18:</strong> To use the } ch aracter as text</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>and</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>deprecated</strong> use && instead. The logical and operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>or</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>deprecated</strong> use || instead. The logical or operator is used to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&&</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> The logical and operator is u sed to group two expressions.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>||</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 or older</strong> the <code>and</code> or <code>or</code> can only be used <strong>once</strong> in a simple language expression. From <strong>Camel 2.5</strong> onwards you can use these operators multiple times.</p></div></div><p>The syntax for AND 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></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 matching if not in a set of values, each element must be separated by comma.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>is</code></p></td><td colspan="1" rowspan="1" class="confluence Td"><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>Camel 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 <stro ng>not</strong> supported using the <a shape="rect" href="file-language.html">File Language</a>.</p><p><span style="color: rgb(255,0,0);"> </span><strong><span style="color: rgb(255,0,0);">Note</span>:</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 sty le="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 <str ong><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"> <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 OR is:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</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"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[${leftValue} OP rightValue or ${leftValue} OP rightValue ]]></script> </div></div><p>Some examples:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -165,17 +166,17 @@ simple("${in.header.bar} == 100&quo // 100 will be converter to the type of in.header.bar so we can do > comparison simple("${in.header.bar} > 100") ]]></script> -</div></div><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Comparing with different types</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When you compare with different types such as String and int, then you have to take a bit care. Camel will use the type from the left hand side as 1st priority. And fallback to the right hand side type if both values couldn't be compared based on that type.<br clear="none"> This means you can flip the values to enforce a specific type. Suppose the bar value above is a String. Then you can flip the equation:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
[... 226 lines stripped ...]