camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandeepreddip <sandeepred...@gmail.com>
Subject Re: Http4 Set Header Content-Type not passing through to the HTTP Request
Date Fri, 27 Jun 2014 15:01:05 GMT

Well, I always had the *Accept header on the GET* Request. Please refer to
my previous posts on the topic.

I tried it directly from the route  and from a processor as below, but both
fail on a GET:

*HttpHeaders.ACCEPT  ="Accept"*

*From a Route*

from("timer:foo?period=1000").setHeader(Exchange.HTTP_METHOD,
constant(org.apache.camel.component.http4.HttpMethods.GET))
                .setHeader(Exchange.CONTENT_TYPE,
constant(RestConstants.APPLICATION_OTHER_XML))
                .setHeader(Exchange.HTTP_CHARACTER_ENCODING,
constant("UTF-8"))
                .setHeader(*HttpHeaders.ACCEPT,
constant(RestConstants.APPLICATION_OTHER_XML)*).to("http4://localhost:8080/cts-rest/cts/users").bean(
CamelBeanBinding.class,"invokeMethod7");

				
*From Processor*
				
@Override
        public void process(Exchange exchange) throws Exception {
                Message message = exchange.getIn();
*       
message.setHeader(HttpHeaders.ACCEPT,RestConstants.APPLICATION_OTHER_XML);*
        message.setHeader(HttpHeaders.ACCEPT_CHARSET, "utf-8");
       
message.setHeader(Exchange.CONTENT_TYPE,RestConstants.APPLICATION_OTHER_XML);
        message.setHeader(HttpHeaders.ACCEPT_LANGUAGE, "en-US");
        message.setHeader(Exchange.CONTENT_ENCODING, "gzip");
        message.setHeader(Exchange.CONTENT_ENCODING, "deflate");
        message.setHeader(Exchange.HTTP_METHOD,"GET");
        message.setHeader(Exchange.HTTP_CHARACTER_ENCODING,"UTF-8");
        exchange.setOut(message);
        } 



--
View this message in context: http://camel.465427.n5.nabble.com/Http4-Set-Header-Content-Type-not-passing-through-to-the-HTTP-Request-tp5746414p5752959.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message