You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/01/11 03:46:50 UTC
svn commit: r1431833 - in /camel/branches/camel-2.10.x: ./
components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Author: ningjiang
Date: Fri Jan 11 02:46:50 2013
New Revision: 1431833
URL: http://svn.apache.org/viewvc?rev=1431833&view=rev
Log:
CAMEL-5954 Unified the variables which are exports to script
Merged revisions 1431784 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1431784 | ningjiang | 2013-01-11 09:36:11 +0800 (Fri, 11 Jan 2013) | 1 line
CAMEL-5954 Unified the variables which are exports to script
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1431784
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java?rev=1431833&r1=1431832&r2=1431833&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java (original)
+++ camel/branches/camel-2.10.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java Fri Jan 11 02:46:50 2013
@@ -31,6 +31,7 @@ import javax.script.ScriptException;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
+import org.apache.camel.Message;
import org.apache.camel.Predicate;
import org.apache.camel.Processor;
import org.apache.camel.converter.ObjectConverter;
@@ -369,10 +370,16 @@ public class ScriptBuilder implements Ex
ScriptContext context = engine.getContext();
int scope = ScriptContext.ENGINE_SCOPE;
context.setAttribute("context", exchange.getContext(), scope);
+ context.setAttribute("camelContext", exchange.getContext(), scope);
context.setAttribute("exchange", exchange, scope);
- context.setAttribute("request", exchange.getIn(), scope);
+ Message in = exchange.getIn();
+ context.setAttribute("in", in, scope);
+ context.setAttribute("request", in, scope);
+ context.setAttribute("headers", in.getHeaders(), scope);
if (exchange.hasOut()) {
- context.setAttribute("response", exchange.getOut(), scope);
+ Message out = exchange.getOut();
+ context.setAttribute("out", out , scope);
+ context.setAttribute("response", out, scope);
}
// to make using properties component easier
context.setAttribute("properties", new ScriptPropertiesFunction(exchange.getContext()), scope);