I'm new to camel and prefer using Spring DSL for route definition. Now I find it's confusing, that http query string parameter are named and handled as headers, what they aren't. Is this an architectural bug in camel?
Incoming http requests will be added as headers on the exchange with the same name as the query parameter.
Below example is from camel documentation
For example, given a client request with the URL, http://myserver/myserver?orderid=123, the exchange will contain a header named orderid with the value 123.
You can set the query parameters for other HTTP calls you make by setting by CamelHttpQuery
header. Exchange.HTTP_QUERY
is the static constant for string CamelHttpQuery
Eg:
from("jetty://0.0.0.0:8080/test")
.setHeader(Exchange.HTTP_QUERY, simple("?param1=${header.param1}")
.to("http://external-url/test")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With