【发布时间】:2021-01-30 10:23:09
【问题描述】:
我遇到以下骆驼 http 请求问题。我想保留 url 查询字符串参数的值,而不将其传递给需要在路由上完成的另一个 http 请求。 http请求外部api处理数据后需要该值。下面是对问题的澄清:
rest("/api")//We get requests as /camel/api?param1=xyz...
.get()
.route()
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.setHeader("Accept-Encoding", constant("gzip"))
.setHeader("Accept", constant("*/*"))
.removeHeader(Exchange.HTTP_URI)//Remove this
//How do I prevent the {header.param1} from being passed to the following http request but still be able to use it after the request on the route?
.to("https://someapi.org/api/...")
//To process the result, we need the original {header.param1} value from the request to this /camel/api endpoint
.endRest();
实现这一目标的正确方法是什么?
【问题讨论】:
-
其实是的,这就回答了!
标签: http apache-camel query-string