This content has been marked as final.
Show 4 replies
-
1. Re: Retrieve headers message in camel route (SwitchYard 1.1)
arteme Jul 13, 2014 5:21 PM (in response to rasilvacw)1 of 1 people found this helpfulHi,
You can pass the request through a processor that can extract HTTP request info object:and copy query params to an exchange property using something like:
from("switchyard://SomeRouteService") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { Message in = exchange.getIn(); HttpRequestInfo reqInfo = in.getHeader(HttpComposition.HTTP_REQUEST_INFO, HttpRequestInfo.class); exchange.setProperty("queryParams", reqInfo.getQueryParams()); exchange.setProperty("queryString", reqInfo.getQueryString()); }) .log("We have: ${property.queryParams} and ${property.queryString} !");
-
2. Re: Re: Retrieve headers message in camel route (SwitchYard 1.1)
jorgemoralespou_2 Jul 14, 2014 5:13 AM (in response to arteme)Or you can just log those directly:
from("switchyard://XXX") .log("method = ${header.http_request_info.method}") .log("pathInfo = ${header.http_request_info.pathInfo}") .log("queryString = ${header.http_request_info.queryString}") .log("body = ${body}") .end();
The http_request object holds some information from the original HTTPServletRequest. components/http/src/main/java/org/switchyard/component/http/composer/HttpRequestInfo.java at master · jboss-switchyard/c…
-
3. Re: Re: Retrieve headers message in camel route (SwitchYard 1.1)
jorgemoralespou_2 Jul 14, 2014 5:15 AM (in response to jorgemoralespou_2)You just need to set http.* in the message composer includes reg exp to allow this header to be progressed from inboundhandler to service.
-
4. Re: Retrieve headers message in camel route (SwitchYard 1.1)
rasilvacw Jul 14, 2014 12:40 PM (in response to jorgemoralespou_2)Thanks Jorge & Artem.