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 Aug 25 
08:22:01 2017
@@ -200,34 +200,18 @@ from("activemq:topic:OrdersTopic&qu
 
 <p>The recipientList element of the Spring DSL can utilize a header expression 
like: </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[
-&lt;route&gt;
-  &lt;from uri=&quot;direct:a&quot; /&gt;
-  &lt;!-- use comma as a delimiter for String based values --&gt;
-  &lt;recipientList delimiter=&quot;,&quot;&gt;
-    &lt;header&gt;myHeader&lt;/header&gt;
-  &lt;/recipientList&gt;
-&lt;/route&gt;
-]]></script>
-</div></div>
+<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/recipientListWithStringDelimitedHeader.xml}</plain-text-body>
 
 <p>In this case, the list of recipients are contained in the header 
'myHeader'. </p>
 
 <p>And the same example in Java DSL:</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(&quot;direct:a&quot;).recipientList(header(&quot;myHeader&quot;));
-]]></script>
-</div></div>
+<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedHeaderTest.java}</plain-text-body>
 
 <p>And with a slightly different syntax where you use the builder to the 
fullest (i.e. avoid using parameters but using stacked operations, notice that 
header is not a parameter but a stacked method call)</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(&quot;direct:a&quot;).recipientList().header(&quot;myHeader&quot;);
-]]></script>
-</div></div>
+<parameter ac:name="">java</parameter><plain-text-body>
+  from("direct:a").recipientList().header("myHeader");
+</plain-text-body>
 
 <h3 id="BookLanguagesAppendix-Dependencies.3">Dependencies</h3>
 <p>The Header language is part of <strong>camel-core</strong>.</p>
@@ -237,13 +221,11 @@ from(&quot;direct:a&quot;).recipientList
 
 <p>You can use XPath expressions directly using smart completion in your IDE 
as follows</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(&quot;queue:foo&quot;).filter().
-  jxpath(&quot;/in/body/foo&quot;).
-  to(&quot;queue:bar&quot;)
-]]></script>
-</div></div>
+<plain-text-body>
+from("queue:foo").filter().
+  jxpath("/in/body/foo").
+  to("queue:bar")
+</plain-text-body>
 
 <h3 id="BookLanguagesAppendix-Variables.1">Variables</h3>
 
@@ -260,38 +242,30 @@ from(&quot;queue:foo&quot;).filter().
 
 <p>If you prefer to configure your routes in your <a shape="rect" 
href="spring.html">Spring</a> XML file then you can use JXPath expressions as 
follows</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[
-&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xsi:schemaLocation=&quot;
+<parameter ac:name="lang">xml</parameter><plain-text-body>
+&lt;beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd"&gt;
 
-  &lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt;
+  &lt;camelContext id="camel" 
xmlns="http://activemq.apache.org/camel/schema/spring"&gt;
     &lt;route&gt;
-      &lt;from uri=&quot;activemq:MyQueue&quot;/&gt;
+      &lt;from uri="activemq:MyQueue"/&gt;
       &lt;filter&gt;
-        &lt;jxpath&gt;in/body/name = &#39;James&#39;&lt;/xpath&gt;
-        &lt;to uri=&quot;mqseries:SomeOtherQueue&quot;/&gt;
+        &lt;jxpath&gt;in/body/name = 'James'&lt;/xpath&gt;
+        &lt;to uri="mqseries:SomeOtherQueue"/&gt;
       &lt;/filter&gt;
     &lt;/route&gt;
   &lt;/camelContext&gt;
 &lt;/beans&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 
 <h3 id="BookLanguagesAppendix-Examples">Examples</h3>
 
 <p>Here is a simple <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/JXPathFilterTest.java";>example</a>
 using a JXPath expression as a predicate in a <a shape="rect" 
href="message-filter.html">Message Filter</a></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(&quot;direct:start&quot;).
-        filter().jxpath(&quot;in/body/name=&#39;James&#39;&quot;).
-        to(&quot;mock:result&quot;);
-]]></script>
-</div></div>
+<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/components/camel-jxpath/src/test/java/org/apache/camel/language/jxpath/JXPathFilterTest.java}</plain-text-body>
 
 <h2 id="BookLanguagesAppendix-JXPathinjection">JXPath injection </h2>
 
@@ -299,17 +273,15 @@ from(&quot;direct:start&quot;).
 
 <p>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[
+<plain-text-body>
 public class Foo {
        
-    @MessageDriven(uri = &quot;activemq:my.queue&quot;)
-    public void doSomething(@JXPath(&quot;in/body/foo&quot;) String 
correlationID, @Body String body) {
+    @MessageDriven(uri = "activemq:my.queue")
+    public void doSomething(@JXPath("in/body/foo") String correlationID, @Body 
String body) {
                // process the inbound message here
     }
 }
-]]></script>
-</div></div>
+</plain-text-body>
 
 
 <h3 id="BookLanguagesAppendix-Loadingscriptfromexternalresource">Loading 
script from external resource</h3>
@@ -317,11 +289,9 @@ public class Foo {
 
 <p>You can externalize the script and have Camel load it from a resource such 
as <code>"classpath:"</code>, <code>"file:"</code>, or <code>"http:"</code>.<br 
clear="none">
 This is done using the following syntax: 
<code>"resource:scheme:location"</code>, eg 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(&quot;myHeader&quot;).jxpath(&quot;resource:classpath:myjxpath.txt&quot;)
-]]></script>
-</div></div>
+<plain-text-body>
+.setHeader("myHeader").jxpath("resource:classpath:myjxpath.txt")
+</plain-text-body>
 
 
 <h3 id="BookLanguagesAppendix-Dependencies.4">Dependencies</h3>
@@ -330,15 +300,13 @@ This is done using the following syntax:
 
 <p>If you use maven you could just add the following to your pom.xml, 
substituting the version number for the latest &amp; greatest release (see <a 
shape="rect" href="download.html">the download page for the latest 
versions</a>).</p>
 
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
+<plain-text-body>
 &lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-jxpath&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 
 <p>Otherwise, you'll also need <a shape="rect" class="external-link" 
href="http://repo2.maven.org/maven2/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar";
 rel="nofollow">Commons JXPath</a>.</p>
 <h2 id="BookLanguagesAppendix-Mvel">Mvel</h2><p>Camel allows Mvel to be used 
as an <a shape="rect" href="expression.html">Expression</a> or <a shape="rect" 
href="predicate.html">Predicate</a> the <a shape="rect" href="dsl.html">DSL</a> 
or <a shape="rect" href="xml-configuration.html">Xml 
Configuration</a>.</p><p>You could use Mvel to create an <a shape="rect" 
href="predicate.html">Predicate</a> in a <a shape="rect" 
href="message-filter.html">Message Filter</a> or as an <a shape="rect" 
href="expression.html">Expression</a> for a <a shape="rect" 
href="recipient-list.html">Recipient List</a></p><p>You can use Mvel dot 
notation to invoke operations. If you for instance have a body that contains a 
POJO that has a <code>getFamiliyName</code> method then you can construct the 
syntax as follows:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
@@ -397,23 +365,8 @@ This is done using the following syntax:
 &lt;/dependency&gt;
 ]]></script>
 </div></div><p>Otherwise, you'll also need <a shape="rect" 
class="external-link" 
href="http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.ognl/2.7.3_4/org.apache.servicemix.bundles.ognl-2.7.3_4.jar";
 rel="nofollow">OGNL</a></p>
-<h2 id="BookLanguagesAppendix-PropertyExpressionLanguage">Property Expression 
Language</h2><p>The Property Expression Language allows you to extract values 
of named exchange properties.</p><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>From <strong>Camel 2.15</strong> 
onwards the property language has been renamed to exchangeProperty to avoid 
ambiguity, confusion and clash with properties as a general term. So use 
exchangeProperty instead of property when using Camel 2.15 
onwards.</p></div></div><p>&#160;</p><h3 
id="BookLanguagesAppendix-Exampleusage.2">Example usage</h3><p>The 
recipientList element of the Spring DSL can utilize a property expression 
like:</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[
-&lt;route&gt;
-  &lt;from uri=&quot;direct:a&quot; /&gt;
-  &lt;recipientList&gt;
-    &lt;exchangeProperty&gt;myProperty&lt;/exchangeProperty&gt;
-  &lt;/recipientList&gt;
-&lt;/route&gt;
-]]></script>
-</div></div><p>In this case, the list of recipients are contained in the 
property 'myProperty'.</p><p>And the same example in Java DSL:</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(&quot;direct:a&quot;).recipientList(property(&quot;myProperty&quot;));
-]]></script>
-</div></div><p>And with a slightly different syntax where you use the builder 
to the fullest (i.e. avoid using parameters but using stacked operations, 
notice that property is not a parameter but a stacked method call)</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(&quot;direct:a&quot;).recipientList().property(&quot;myProperty&quot;);
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-Dependencies.7">Dependencies</h3><p>The Property 
language is part of <strong>camel-core</strong>.</p>
+<h2 id="BookLanguagesAppendix-PropertyExpressionLanguage">Property Expression 
Language</h2><p>The Property Expression Language allows you to extract values 
of named exchange properties.</p><rich-text-body><p>From <strong>Camel 
2.15</strong> onwards the property language has been renamed to 
exchangeProperty to avoid ambiguity, confusion and clash with properties as a 
general term. So use exchangeProperty instead of property when using Camel 2.15 
onwards.</p></rich-text-body><p>&#160;</p><h3 
id="BookLanguagesAppendix-Exampleusage.2">Example usage</h3><p>The 
recipientList element of the Spring DSL can utilize a property expression 
like:</p><plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/recipientListWithStringDelimitedProperty.xml}</plain-text-body><p>In
 this case, the list of recipients are contained in the property 
'myProperty'.</p><p>And the same example in Java 
DSL:</p><plain-text-body>{snippet:id
 
=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RecipientListWithStringDelimitedPropertyTest.java}</plain-text-body><p>And
 with a slightly different syntax where you use the builder to the fullest 
(i.e. avoid using parameters but using stacked operations, notice that property 
is not a parameter but a stacked method call)</p><parameter 
ac:name="">java</parameter><plain-text-body>  
from("direct:a").recipientList().property("myProperty");
+</plain-text-body><h3 
id="BookLanguagesAppendix-Dependencies.7">Dependencies</h3><p>The Property 
language is part of <strong>camel-core</strong>.</p>
 <h2 id="BookLanguagesAppendix-ScriptingLanguages">Scripting Languages</h2>
 
 <p>Camel supports a number of scripting languages which can be used to create 
an <a shape="rect" href="expression.html">Expression</a> or <a shape="rect" 
href="predicate.html">Predicate</a> via the standard <a shape="rect" 
class="external-link" href="http://jcp.org/en/jsr/detail?id=223"; 
rel="nofollow">JSR 223</a> which is a standard part of Java 6. </p>
@@ -425,46 +378,19 @@ from(&quot;direct:a&quot;).recipientList
 
 <p>However any <a shape="rect" class="external-link" 
href="http://jcp.org/en/jsr/detail?id=223"; rel="nofollow">JSR 223</a> scripting 
language can be used using the generic DSL methods.</p>
 
-<h3 id="BookLanguagesAppendix-ScriptContextOptions"><code>ScriptContext</code> 
Options</h3><p>&#160;</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">The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</div></div><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>or
 g.apache.camel.CamelContext</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The Camel Context.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>context</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Functio
 n with a <strong><code>resolve</code></strong> method to make it easier to use 
Camels <a shape="rect" href="properties.html">Properties</a> component from 
scripts. See further below for example.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>request</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message instead.</p></td><
 /tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-PassingAdditionalArgumentstotheScriptingEngine">Passing
 Additional Arguments to 
the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>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[
-public void testArgumentsExample() throws Exception {
-    getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
-    getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
-
-    // additional arguments to ScriptEngine
-    Map&lt;String, Object&gt; arguments = new HashMap&lt;String, Object&gt;();
-    arguments.put(&quot;foo&quot;, &quot;bar&quot;);
-    arguments.put(&quot;baz&quot;, 7);
-
-    // those additional arguments is provided as a header on the Camel Message
-    template.sendBodyAndHeader(&quot;direct:start&quot;, &quot;hello&quot;, 
ScriptBuilder.ARGUMENTS, arguments);
-
-    assertMockEndpointsSatisfied();
-}
-]]></script>
-</div></div><h3 id="BookLanguagesAppendix-UsingPropertiesFunction">Using 
Properties Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If 
you need to use the <a shape="rect" href="properties.html">Properties</a> 
component from a script to lookup property placeholders, then its a bit 
cumbersome to do so. For example, to set a header 
name&#160;<strong><code>myHeader</code></strong> with a value from a property 
placeholder, whose key is taken from a header named 
<strong><code>foo</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[.setHeader(&quot;myHeader&quot;).groovy(&quot;context.resolvePropertyPlaceholders(&#39;{{&#39;
 + request.headers.get(&#39;foo&#39;) + &#39;}}&#39;)&quot;)
-]]></script>
-</div></div><p>From <strong>Camel 2.9</strong>: you can now use the properties 
function and the same example is simpler:</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(&quot;myHeader&quot;).groovy(&quot;properties.resolve(request.headers.get(&#39;foo&#39;))&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> 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(&quot;myHeader&quot;).groovy(&quot;resource:classpath:mygroovy.groovy&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript">How to 
Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[bar = &quot;baz&quot;;
+<h3 id="BookLanguagesAppendix-ScriptContextOptions"><code>ScriptContext</code> 
Options</h3><p>&#160;</p><rich-text-body>The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>context</code></p
 ></td><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td
 > colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
 >used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
 >colspan="1" rowspan="1" class="confluenceTd"><p>The current 
 >Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
 >rowspan="1" 
 >class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 > colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
 >Function with a <strong><code>resolve</code></strong> method to make it 
 >easier to use Camels <a shape="rect" href="properties.html">Properties</a> 
 >component from scripts. See further below for example.</p></td></t
 r><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message 
instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-PassingAddition
 alArgumentstotheScriptingEngine">Passing Additional Arguments to 
the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java}</plain-text-body></p><h3
 id="BookLanguagesAppendix-UsingPropertiesFunction">Using Properties 
Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If you need to 
use the <a shape="rect" href="properties.html">Properties</a> component from a 
script to lookup property placeholders, then its a bit cumbersome to do so. For 
example, to set a header name&#160;<strong><code>myHeader</code></strong> with 
a value from a property placeholder, whose key is taken from a he
 ader named 
<strong><code>foo</code></strong>.</p><plain-text-body>.setHeader("myHeader").groovy("context.resolvePropertyPlaceholders('{{'
 + request.headers.get('foo') + '}}')")
+</plain-text-body><p>From <strong>Camel 2.9</strong>: you can now use the 
properties function and the same example is simpler:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
+</plain-text-body><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> e.g. to refer to a file 
on the classpath you can do:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
+</plain-text-body><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript">How to 
Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><parameter ac:name="language">text</parameter><plain-text-body>bar = 
"baz";
 # some other statements ... 
 # camel take the result value as the script evaluation result
 result = body * 2 + 1
-]]></script>
-</div></div><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.8">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+</plain-text-body><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.8">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-script&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 
 <h2 id="BookLanguagesAppendix-SeeAlso">See Also</h2>
 
@@ -499,46 +425,19 @@ result = body * 2 + 1
 
 <p>You could follow the examples above to create an <a shape="rect" 
href="predicate.html">Predicate</a> in a <a shape="rect" 
href="message-filter.html">Message Filter</a> or as an <a shape="rect" 
href="expression.html">Expression</a> for a <a shape="rect" 
href="recipient-list.html">Recipient List</a></p>
 
-<h3 
id="BookLanguagesAppendix-ScriptContextOptions.1"><code>ScriptContext</code> 
Options</h3><p>&#160;</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">The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</div></div><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>
 org.apache.camel.CamelContext</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The Camel Context.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>context</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Funct
 ion with a <strong><code>resolve</code></strong> method to make it easier to 
use Camels <a shape="rect" href="properties.html">Properties</a> component from 
scripts. See further below for example.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>request</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message instead.</p></td
 ></tr></tbody></table></div><p>See <a shape="rect" 
 >href="scripting-languages.html">Scripting Languages</a> for the list of 
 >languages with explicit DSL support.</p><h3 
 >id="BookLanguagesAppendix-PassingAdditionalArgumentstotheScriptingEngine.1">Passing
 > Additional Arguments to 
 >the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
 >2.8</strong></p><p>You can provide additional arguments to the 
 ><strong><code>ScriptingEngine</code></strong> using a header on the Camel 
 >message with the key 
 ><strong><code>CamelScriptArguments</code></strong>.</p><p>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[
-public void testArgumentsExample() throws Exception {
-    getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
-    getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
-
-    // additional arguments to ScriptEngine
-    Map&lt;String, Object&gt; arguments = new HashMap&lt;String, Object&gt;();
-    arguments.put(&quot;foo&quot;, &quot;bar&quot;);
-    arguments.put(&quot;baz&quot;, 7);
-
-    // those additional arguments is provided as a header on the Camel Message
-    template.sendBodyAndHeader(&quot;direct:start&quot;, &quot;hello&quot;, 
ScriptBuilder.ARGUMENTS, arguments);
-
-    assertMockEndpointsSatisfied();
-}
-]]></script>
-</div></div><h3 id="BookLanguagesAppendix-UsingPropertiesFunction.1">Using 
Properties Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If 
you need to use the <a shape="rect" href="properties.html">Properties</a> 
component from a script to lookup property placeholders, then its a bit 
cumbersome to do so. For example, to set a header 
name&#160;<strong><code>myHeader</code></strong> with a value from a property 
placeholder, whose key is taken from a header named 
<strong><code>foo</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[.setHeader(&quot;myHeader&quot;).groovy(&quot;context.resolvePropertyPlaceholders(&#39;{{&#39;
 + request.headers.get(&#39;foo&#39;) + &#39;}}&#39;)&quot;)
-]]></script>
-</div></div><p>From <strong>Camel 2.9</strong>: you can now use the properties 
function and the same example is simpler:</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(&quot;myHeader&quot;).groovy(&quot;properties.resolve(request.headers.get(&#39;foo&#39;))&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.1">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> 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(&quot;myHeader&quot;).groovy(&quot;resource:classpath:mygroovy.groovy&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.1">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[bar = &quot;baz&quot;;
+<h3 
id="BookLanguagesAppendix-ScriptContextOptions.1"><code>ScriptContext</code> 
Options</h3><p>&#160;</p><rich-text-body>The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>context</code><
 /p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <strong><code>resolve</code></strong> method to make it easier 
to use Camels <a shape="rect" href="properties.html">Properties</a> component 
from scripts. See further below for example.</p></td><
 /tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message 
instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-PassingAdditi
 onalArgumentstotheScriptingEngine.1">Passing Additional Arguments to 
the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java}</plain-text-body></p><h3
 id="BookLanguagesAppendix-UsingPropertiesFunction.1">Using Properties 
Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If you need to 
use the <a shape="rect" href="properties.html">Properties</a> component from a 
script to lookup property placeholders, then its a bit cumbersome to do so. For 
example, to set a header name&#160;<strong><code>myHeader</code></strong> with 
a value from a property placeholder, whose key is taken fro
 m a header named 
<strong><code>foo</code></strong>.</p><plain-text-body>.setHeader("myHeader").groovy("context.resolvePropertyPlaceholders('{{'
 + request.headers.get('foo') + '}}')")
+</plain-text-body><p>From <strong>Camel 2.9</strong>: you can now use the 
properties function and the same example is simpler:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
+</plain-text-body><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.1">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> e.g. to refer to a file 
on the classpath you can do:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
+</plain-text-body><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.1">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><parameter ac:name="language">text</parameter><plain-text-body>bar = 
"baz";
 # some other statements ... 
 # camel take the result value as the script evaluation result
 result = body * 2 + 1
-]]></script>
-</div></div><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.9">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+</plain-text-body><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.9">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-script&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 <h2 id="BookLanguagesAppendix-JavaScript">JavaScript</h2>
 
 <p>Camel supports <a shape="rect" class="external-link" 
href="http://en.wikipedia.org/wiki/JavaScript"; 
rel="nofollow">JavaScript/ECMAScript</a> among other <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> to allow an <a 
shape="rect" href="expression.html">Expression</a> or <a shape="rect" 
href="predicate.html">Predicate</a> to be used in the <a shape="rect" 
href="dsl.html">DSL</a> or <a shape="rect" href="xml-configuration.html">Xml 
Configuration</a>.</p>
@@ -583,46 +482,19 @@ result = body * 2 + 1
 ]]></script>
 </div></div>
 
-<h3 
id="BookLanguagesAppendix-ScriptContextOptions.2"><code>ScriptContext</code> 
Options</h3><p>&#160;</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">The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</div></div><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>
 org.apache.camel.CamelContext</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The Camel Context.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>context</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Funct
 ion with a <strong><code>resolve</code></strong> method to make it easier to 
use Camels <a shape="rect" href="properties.html">Properties</a> component from 
scripts. See further below for example.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>request</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message instead.</p></td
 ></tr></tbody></table></div><p>See <a shape="rect" 
 >href="scripting-languages.html">Scripting Languages</a> for the list of 
 >languages with explicit DSL support.</p><h3 
 >id="BookLanguagesAppendix-PassingAdditionalArgumentstotheScriptingEngine.2">Passing
 > Additional Arguments to 
 >the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
 >2.8</strong></p><p>You can provide additional arguments to the 
 ><strong><code>ScriptingEngine</code></strong> using a header on the Camel 
 >message with the key 
 ><strong><code>CamelScriptArguments</code></strong>.</p><p>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[
-public void testArgumentsExample() throws Exception {
-    getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
-    getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
-
-    // additional arguments to ScriptEngine
-    Map&lt;String, Object&gt; arguments = new HashMap&lt;String, Object&gt;();
-    arguments.put(&quot;foo&quot;, &quot;bar&quot;);
-    arguments.put(&quot;baz&quot;, 7);
-
-    // those additional arguments is provided as a header on the Camel Message
-    template.sendBodyAndHeader(&quot;direct:start&quot;, &quot;hello&quot;, 
ScriptBuilder.ARGUMENTS, arguments);
-
-    assertMockEndpointsSatisfied();
-}
-]]></script>
-</div></div><h3 id="BookLanguagesAppendix-UsingPropertiesFunction.2">Using 
Properties Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If 
you need to use the <a shape="rect" href="properties.html">Properties</a> 
component from a script to lookup property placeholders, then its a bit 
cumbersome to do so. For example, to set a header 
name&#160;<strong><code>myHeader</code></strong> with a value from a property 
placeholder, whose key is taken from a header named 
<strong><code>foo</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[.setHeader(&quot;myHeader&quot;).groovy(&quot;context.resolvePropertyPlaceholders(&#39;{{&#39;
 + request.headers.get(&#39;foo&#39;) + &#39;}}&#39;)&quot;)
-]]></script>
-</div></div><p>From <strong>Camel 2.9</strong>: you can now use the properties 
function and the same example is simpler:</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(&quot;myHeader&quot;).groovy(&quot;properties.resolve(request.headers.get(&#39;foo&#39;))&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.2">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> 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(&quot;myHeader&quot;).groovy(&quot;resource:classpath:mygroovy.groovy&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.2">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[bar = &quot;baz&quot;;
+<h3 
id="BookLanguagesAppendix-ScriptContextOptions.2"><code>ScriptContext</code> 
Options</h3><p>&#160;</p><rich-text-body>The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>context</code><
 /p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <strong><code>resolve</code></strong> method to make it easier 
to use Camels <a shape="rect" href="properties.html">Properties</a> component 
from scripts. See further below for example.</p></td><
 /tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message 
instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-PassingAdditi
 onalArgumentstotheScriptingEngine.2">Passing Additional Arguments to 
the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java}</plain-text-body></p><h3
 id="BookLanguagesAppendix-UsingPropertiesFunction.2">Using Properties 
Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If you need to 
use the <a shape="rect" href="properties.html">Properties</a> component from a 
script to lookup property placeholders, then its a bit cumbersome to do so. For 
example, to set a header name&#160;<strong><code>myHeader</code></strong> with 
a value from a property placeholder, whose key is taken fro
 m a header named 
<strong><code>foo</code></strong>.</p><plain-text-body>.setHeader("myHeader").groovy("context.resolvePropertyPlaceholders('{{'
 + request.headers.get('foo') + '}}')")
+</plain-text-body><p>From <strong>Camel 2.9</strong>: you can now use the 
properties function and the same example is simpler:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
+</plain-text-body><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.2">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> e.g. to refer to a file 
on the classpath you can do:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
+</plain-text-body><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.2">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><parameter ac:name="language">text</parameter><plain-text-body>bar = 
"baz";
 # some other statements ... 
 # camel take the result value as the script evaluation result
 result = body * 2 + 1
-]]></script>
-</div></div><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.10">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+</plain-text-body><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.10">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-script&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 <h2 id="BookLanguagesAppendix-Groovy">Groovy</h2><p>Camel supports <a 
shape="rect" class="external-link" href="http://groovy.codehaus.org/"; 
rel="nofollow">Groovy</a> among other <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> to allow an <a 
shape="rect" href="expression.html">Expression</a> or <a shape="rect" 
href="predicate.html">Predicate</a> to be used in the <a shape="rect" 
href="dsl.html">DSL</a> or <a shape="rect" href="xml-configuration.html">Xml 
Configuration</a>.</p><p>To use a Groovy expression use the following Java 
code</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[... groovy(&quot;someGroovyExpression&quot;) 
... 
 ]]></script>
@@ -651,46 +523,19 @@ from(&quot;queue:foo&quot;).filter(groov
             &lt;/filter&gt;
         &lt;/route&gt;
 ]]></script>
-</div></div><p></p><h3 
id="BookLanguagesAppendix-ScriptContextOptions.3"><code>ScriptContext</code> 
Options</h3><p>&#160;</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">The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</div></div><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" class="conf
 luenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>context</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
 2.9:</strong> Function with a <strong><code>resolve</code></strong> method to 
make it easier to use Camels <a shape="rect" 
href="properties.html">Properties</a> component from scripts. See further below 
for example.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> messa
 ge instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-PassingAdditionalArgumentstotheScriptingEngine.3">Passing
 Additional Arguments to 
the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>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[
-public void testArgumentsExample() throws Exception {
-    getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
-    getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
-
-    // additional arguments to ScriptEngine
-    Map&lt;String, Object&gt; arguments = new HashMap&lt;String, Object&gt;();
-    arguments.put(&quot;foo&quot;, &quot;bar&quot;);
-    arguments.put(&quot;baz&quot;, 7);
-
-    // those additional arguments is provided as a header on the Camel Message
-    template.sendBodyAndHeader(&quot;direct:start&quot;, &quot;hello&quot;, 
ScriptBuilder.ARGUMENTS, arguments);
-
-    assertMockEndpointsSatisfied();
-}
-]]></script>
-</div></div><h3 id="BookLanguagesAppendix-UsingPropertiesFunction.3">Using 
Properties Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If 
you need to use the <a shape="rect" href="properties.html">Properties</a> 
component from a script to lookup property placeholders, then its a bit 
cumbersome to do so. For example, to set a header 
name&#160;<strong><code>myHeader</code></strong> with a value from a property 
placeholder, whose key is taken from a header named 
<strong><code>foo</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[.setHeader(&quot;myHeader&quot;).groovy(&quot;context.resolvePropertyPlaceholders(&#39;{{&#39;
 + request.headers.get(&#39;foo&#39;) + &#39;}}&#39;)&quot;)
-]]></script>
-</div></div><p>From <strong>Camel 2.9</strong>: you can now use the properties 
function and the same example is simpler:</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(&quot;myHeader&quot;).groovy(&quot;properties.resolve(request.headers.get(&#39;foo&#39;))&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.3">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> 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(&quot;myHeader&quot;).groovy(&quot;resource:classpath:mygroovy.groovy&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.3">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[bar = &quot;baz&quot;;
+</div></div><p></p><h3 
id="BookLanguagesAppendix-ScriptContextOptions.3"><code>ScriptContext</code> 
Options</h3><p>&#160;</p><rich-text-body>The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><c
 ode>context</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <strong><code>resolve</code></strong> method to make it easier 
to use Camels <a shape="rect" href="properties.html">Properties</a> component 
from scripts. See further below for
  example.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message 
instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 id="BookLanguagesApp
 endix-PassingAdditionalArgumentstotheScriptingEngine.3">Passing Additional 
Arguments to the&#160;<code>ScriptingEngine</code></h3><p><strong>Available 
from Camel 2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java}</plain-text-body></p><h3
 id="BookLanguagesAppendix-UsingPropertiesFunction.3">Using Properties 
Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If you need to 
use the <a shape="rect" href="properties.html">Properties</a> component from a 
script to lookup property placeholders, then its a bit cumbersome to do so. For 
example, to set a header name&#160;<strong><code>myHeader</code></strong> with 
a value from a property placeholder, who
 se key is taken from a header named 
<strong><code>foo</code></strong>.</p><plain-text-body>.setHeader("myHeader").groovy("context.resolvePropertyPlaceholders('{{'
 + request.headers.get('foo') + '}}')")
+</plain-text-body><p>From <strong>Camel 2.9</strong>: you can now use the 
properties function and the same example is simpler:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
+</plain-text-body><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.3">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> e.g. to refer to a file 
on the classpath you can do:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")
+</plain-text-body><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.3">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><parameter ac:name="language">text</parameter><plain-text-body>bar = 
"baz";
 # some other statements ... 
 # camel take the result value as the script evaluation result
 result = body * 2 + 1
-]]></script>
-</div></div><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.11">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
+</plain-text-body><p>&#160;</p><h3 
id="BookLanguagesAppendix-Dependencies.11">Dependencies</h3><p>To use scripting 
languages in your camel routes you need to add the a dependency on 
<strong><code>camel-script</code></strong> which integrates the JSR-223 
scripting engine.</p><p>If you use maven you could just add the following to 
your <strong><code>pom.xml</code></strong>, substituting the version number for 
the latest &amp; greatest release (see <a shape="rect" href="download.html">the 
download page for the latest versions</a>).</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-script&lt;/artifactId&gt;
   &lt;version&gt;x.x.x&lt;/version&gt;
 &lt;/dependency&gt;
-]]></script>
-</div></div>
+</plain-text-body>
 <h2 id="BookLanguagesAppendix-Python">Python</h2><p>Camel supports <a 
shape="rect" class="external-link" href="http://www.python.org/"; 
rel="nofollow">Python</a> among other <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> to allow an <a 
shape="rect" href="expression.html">Expression</a> or <a shape="rect" 
href="predicate.html">Predicate</a> to be used in the <a shape="rect" 
href="dsl.html">DSL</a> or <a shape="rect" href="xml-configuration.html">Xml 
Configuration</a>.</p><p>To use a Python expression use the following Java 
code</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[... python(&quot;somePythonExpression&quot;) 
... 
 ]]></script>
@@ -715,46 +560,19 @@ result = body * 2 + 1
         &lt;/choice&gt;
     &lt;/route&gt;
 ]]></script>
-</div></div><p></p><h3 
id="BookLanguagesAppendix-ScriptContextOptions.4"><code>ScriptContext</code> 
Options</h3><p>&#160;</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">The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</div></div><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" class="conf
 luenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>context</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
 2.9:</strong> Function with a <strong><code>resolve</code></strong> method to 
make it easier to use Camels <a shape="rect" 
href="properties.html">Properties</a> component from scripts. See further below 
for example.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> messa
 ge instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-PassingAdditionalArgumentstotheScriptingEngine.4">Passing
 Additional Arguments to 
the&#160;<code>ScriptingEngine</code></h3><p><strong>Available from Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>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[
-public void testArgumentsExample() throws Exception {
-    getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
-    getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
-
-    // additional arguments to ScriptEngine
-    Map&lt;String, Object&gt; arguments = new HashMap&lt;String, Object&gt;();
-    arguments.put(&quot;foo&quot;, &quot;bar&quot;);
-    arguments.put(&quot;baz&quot;, 7);
-
-    // those additional arguments is provided as a header on the Camel Message
-    template.sendBodyAndHeader(&quot;direct:start&quot;, &quot;hello&quot;, 
ScriptBuilder.ARGUMENTS, arguments);
-
-    assertMockEndpointsSatisfied();
-}
-]]></script>
-</div></div><h3 id="BookLanguagesAppendix-UsingPropertiesFunction.4">Using 
Properties Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If 
you need to use the <a shape="rect" href="properties.html">Properties</a> 
component from a script to lookup property placeholders, then its a bit 
cumbersome to do so. For example, to set a header 
name&#160;<strong><code>myHeader</code></strong> with a value from a property 
placeholder, whose key is taken from a header named 
<strong><code>foo</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[.setHeader(&quot;myHeader&quot;).groovy(&quot;context.resolvePropertyPlaceholders(&#39;{{&#39;
 + request.headers.get(&#39;foo&#39;) + &#39;}}&#39;)&quot;)
-]]></script>
-</div></div><p>From <strong>Camel 2.9</strong>: you can now use the properties 
function and the same example is simpler:</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(&quot;myHeader&quot;).groovy(&quot;properties.resolve(request.headers.get(&#39;foo&#39;))&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.4">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> 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(&quot;myHeader&quot;).groovy(&quot;resource:classpath:mygroovy.groovy&quot;)
-]]></script>
-</div></div><h3 
id="BookLanguagesAppendix-HowtoGettheResultfromMultipleStatementsScript.4">How 
to Get the Result from Multiple Statements Script</h3><p><strong>Available from 
Camel 2.14</strong></p><p>The script engine's eval method returns 
a&#160;<strong><code>null</code></strong> when it runs a multi-statement 
script. However, Camel can look up the value of a script's result by using the 
key <strong><code>result</code></strong> from the value set. When writing a 
multi-statement script set the value of 
the&#160;<strong><code>result</code></strong> variable as the script return 
value.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: text; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[bar = &quot;baz&quot;;
+</div></div><p></p><h3 
id="BookLanguagesAppendix-ScriptContextOptions.4"><code>ScriptContext</code> 
Options</h3><p>&#160;</p><rich-text-body>The&#160;<code>JSR-223</code> 
scripting language's&#160;<strong><code>ScriptContext</code></strong> is 
pre-configured with the following attributes all set at 
<strong><code>ENGINE_SCOPE</code></strong>.</rich-text-body><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span><code>camelContext</code><br 
clear="none"></span></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel 
Context.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><c
 ode>context</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context (cannot be 
used in groovy).</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>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>properties</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <strong><code>resolve</code></strong> method to make it easier 
to use Camels <a shape="rect" href="properties.html">Properties</a> component 
from scripts. See further below for
  example.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>request</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>The&#160;<strong><code>IN</code></strong> 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>response</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The&#160;<strong><code>OUT</code></strong> message. 
The&#160;<strong><code>OUT</code></strong> message 
is&#160;<strong><code>null</code></strong> by default. Use the 
<strong><code>IN</code></strong> message 
instead.</p></td></tr></tbody></table></div><p>See <a shape="rect" 
href="scripting-languages.html">Scripting Languages</a> for the list of 
languages with explicit DSL support.</p><h3 id="BookLanguagesApp
 endix-PassingAdditionalArgumentstotheScriptingEngine.4">Passing Additional 
Arguments to the&#160;<code>ScriptingEngine</code></h3><p><strong>Available 
from Camel 2.8</strong></p><p>You can provide additional arguments to the 
<strong><code>ScriptingEngine</code></strong> using a header on the Camel 
message with the key 
<strong><code>CamelScriptArguments</code></strong>.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java}</plain-text-body></p><h3
 id="BookLanguagesAppendix-UsingPropertiesFunction.4">Using Properties 
Function</h3><p><strong>Available from Camel 2.9</strong></p><p>If you need to 
use the <a shape="rect" href="properties.html">Properties</a> component from a 
script to lookup property placeholders, then its a bit cumbersome to do so. For 
example, to set a header name&#160;<strong><code>myHeader</code></strong> with 
a value from a property placeholder, who
 se key is taken from a header named 
<strong><code>foo</code></strong>.</p><plain-text-body>.setHeader("myHeader").groovy("context.resolvePropertyPlaceholders('{{'
 + request.headers.get('foo') + '}}')")
+</plain-text-body><p>From <strong>Camel 2.9</strong>: you can now use the 
properties function and the same example is simpler:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("properties.resolve(request.headers.get('foo'))")
+</plain-text-body><h3 
id="BookLanguagesAppendix-LoadingScriptFromExternalResource.4">Loading Script 
From External Resource</h3><p><strong>Available from Camel 
2.11</strong></p><p>You can externalize the script and have Camel load it from 
a resource such as <strong><code>classpath:</code></strong>, 
<strong><code>file:</code></strong>, or <strong><code>http:</code></strong>. 
This is done using the following syntax: 
<strong><code>resource:scheme:location</code></strong> e.g. to refer to a file 
on the classpath you can do:</p><parameter 
ac:name="language">java</parameter><plain-text-body>.setHeader("myHeader").groovy("resource:classpath:mygroovy.groovy")

[... 881 lines stripped ...]

Reply via email to