camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Http4 Set Header Content-Type not passing through to the HTTP Request
Date Fri, 27 Jun 2014 02:04:01 GMT
The content-type is part of request entity,  as there is no request entity body in the GET
Http method, camel-http4 doesn’t put the Content-Type header into http header.

Here a discussion[1] which is about it in stack overflow.

[1]http://stackoverflow.com/questions/5661596/do-i-need-a-content-type-for-http-get-requests

--  
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 3:10:21 AM, sandeepreddip (sandeepreddip@gmail.com) wrote:
> Thanks for the reply,bit I'm a bit confused, I indeed set the headers on *
> Message message = exchange.getIn(); *
> *Attached is complete trace of the route. Camel_http4_GET_trace.txt
>  
> * I appreciate if you could shed some more light on it.
>  
> I tried by directly setting the header on the route. But still faced the
> same issue.
>  
> /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");/
>  
> *Below is the trace of the Message History*
>  
>  
>  
> *Message History*
> ---------------------------------------------------------------------------------------------------------------------------------------
 
> RouteId ProcessorId Processor
> Elapsed (ms)
> [route1 ] [route1 ] [timer://foo?period=1000
> ] [ 79]
> [route1 ] [setHeader1 ] [setHeader[CamelHttpMethod]
> ] [ 0]
> [route1 ] [setHeader2 ] [setHeader[Content-Type]
> ] [ 0]
> [route1 ] [setHeader3 ]
> [setHeader[CamelHttpCharacterEncoding]
> ] [ 0]
> [route1 ] [setHeader4 ] [setHeader[Accept]
> ] [ 0]
> [route1 ] [to1 ]
> [http4://localhost:8080/cts-rest/cts/users
> ] [ 79]
>  
> *Exchange*
> ---------------------------------------------------------------------------------------------------------------------------------------
 
> Exchange[
> Id ID-sporeddy-60089-1403808232902-0-2
> ExchangePattern InOnly
> Headers {Accept=application/*+xml,
> breadcrumbId=ID-sporeddy-60089-1403808232902-0-1,
> CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=GET,
> CamelRedelivered=false, CamelRedeliveryCounter=0,
> Content-Type=application/*+xml, firedTime=Thu Jun 26 14:43:54 EDT 2014}
> BodyType null
> Body [Body is null]
> ]
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Http4-Set-Header-Content-Type-not-passing-through-to-the-HTTP-Request-tp5746414p5752892.html
 
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Mime
View raw message