简体   繁体   English

带有骆驼+ Groovy + Spring DSL的奇怪Behaiour

[英]Strange Behaiour with Camel + Groovy + Spring DSL

I have the following route: 我有以下路线:

    <camel:camelContext  id="convert">
            <camel:route>
            <camel:from uri="restlet:/convert/{id}"/>
            <camel:transform>
                <camel:groovy>
                    request.headers.id
                </camel:groovy>
             </camel:transform>
        </camel:route>
    </camel:camelContext>

This route should simply return the value passed in the URL as id parameter. 该路由应该简单地返回URL中作为id参数传递的值。 When I execute this, the first call works. 执行此操作时,第一个调用起作用。 Anything after the first call returns the value passed in the first call. 第一次调用后的所有内容都会返回在第一次调用中传递的值。 So, if first call is hostname/convert/999, any other call will return 999 no matter what id is passed in the URL. 因此,如果第一个调用是主机名/转换/ 999,则无论在URL中传递了什么id,任何其他调用都将返回999。 It looks like groovy is doing some stateful thing that I don't understand. 看来groovy正在做一些我不了解的有状态的事情。

Any thoughts? 有什么想法吗?

The same thing seems to happen with JavaScript. JavaScript似乎也发生了同样的事情。

  <camel:camelContext  id="convert">
         <camel:route>
            <camel:from uri="restlet:/convert/{id}"/>
             <camel:transform>
                <camel:javaScript>request.headers.get('id')</camel:javaScript>
             </camel:transform>
        </camel:route>
  </camel:camelContext>

Okay so the groovy issue is a regression bug in Camel. 好的,所以常见问题是Camel中的回归错误。 I have logged a ticket to get this fixed in newer release of Camel: https://issues.apache.org/jira/browse/CAMEL-7143 我已记录了一张票,以在更新的Camel版本中解决此问题: https : //issues.apache.org/jira/browse/CAMEL-7143

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM