camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: Potential bug with setHeader and scripts?
Date Fri, 05 Sep 2008 17:28:13 GMT
Hi

Yeah I guess the best is to look if the exchange is out capable (ExchangeHelper.isOutCapable
- I think) and then only set the response context.

We would like to look and fix it. The best is to log a ticket in JIRA and if possible some
code showing the problem, such as a route example, unit test or the like.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Kingjamm [mailto:kingjamm@zoji.com] 
Sent: 5. september 2008 19:17
To: camel-user@activemq.apache.org
Subject: Potential bug with setHeader and scripts?


So trying to figure this out, I looked into the source, and found that if the
getOut is not null, the out message is used to set the header in the
setHeader processor. Unfortunately in the script engine this block of code
always ensures that it's NOT null.

script builder class line 520 of Camel 1.4

        ScriptContext context = engine.getContext();
        int scope = ScriptContext.ENGINE_SCOPE;
        context.setAttribute("context", exchange.getContext(), scope);
        context.setAttribute("exchange", exchange, scope);
        context.setAttribute("request", exchange.getIn(), scope);
        context.setAttribute("response", exchange.getOut(), scope);

The place were the out message is used is here in the Pipeline class at line
79

            if (first) {
                first = false;
            } else {
                nextExchange = createNextExchange(processor, nextExchange);
            }

Is the correct behavior to call the getOut in the scripbuilder with an
argument of false or is there something more subtle going on here?
-- 
View this message in context: http://www.nabble.com/Potential-bug-with-setHeader-and-scripts--tp19335805s22882p19335805.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message