I just found camel-cxfrs can set the content-type even with get request. Maybe 
you can consider to use camel-cxfrs instead of camel-http4 component to that 
job.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 27, 2014 at 11:09:16 PM, sandeepreddip (sandeepred...@gmail.com) wrote:
>  
> 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.
>  

Reply via email to