【发布时间】: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