【问题标题】:Apache Camel Pass ParameterApache Camel 传递参数
【发布时间】:2013-11-04 17:22:34
【问题描述】:

谁能告诉我如何将参数从“from”传递到“to”。

from("jetty:http://localhost:8080/processrequest")
    .process(inComingRequestProcessor)      
    .to("restlet:http://callservice.com?id=${id}")      
    .unmarshal().json(JsonLibrary.Jackson, Data.class)
    .beanRef("httpServiceProcessor", "process").log("${body}");

我从 localhost:8080/processrequest 获取 id 并希望传递与查询参数相同的参数。

【问题讨论】:

  • 基于camel.apache.org/jetty.htmt,它表示参数填充在骆驼标题中。所以你应该试试${header.id}
  • 我尝试通过添加 ${header.id} 来实现这一点,但是值没有传递给 url。我在传入请求处理器中添加标头,例如 exchange.getIn().setHeader("id", "123456");
  • 好的,最后我设法将标题值设为 ${header.id}

标签: java rest apache-camel restlet


【解决方案1】:

查看常见问题解答 - 有一些答案:)

有一个关于 dynamic to 的常见问题解答说明了这一点并说明了如何解决它:http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

【讨论】:

    猜你喜欢
    • 2015-01-02
    • 2019-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-16
    • 1970-01-01
    • 2013-04-11
    相关资源
    最近更新 更多