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:52:11 UTC
svn commit: r1431835 - in /camel/branches/camel-2.9.x: ./
components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Author: ningjiang
Date: Fri Jan 11 02:52:11 2013
New Revision: 1431835
URL: http://svn.apache.org/viewvc?rev=1431835&view=rev
Log:
CAMEL-5954 Unified the variables which are exports to script
Merged revisions 1431833 via svnmerge from
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x
................
r1431833 | ningjiang | 2013-01-11 10:46:50 +0800 (Fri, 11 Jan 2013) | 10 lines
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.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1431784
Merged /camel/branches/camel-2.10.x:r1431833
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java?rev=1431835&r1=1431834&r2=1431835&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java (original)
+++ camel/branches/camel-2.9.x/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java Fri Jan 11 02:52:11 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);