You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "E. A. English" <ee...@ikindi.com> on 2014/01/23 20:28:33 UTC

Http4 Set Header Content-Type not passing through to the HTTP Request

Hi,

setting the Content-type header for Http4 Camel Route - Message headers from
the IN message are not being copied to the OUT message 

Using Camel Version 2.12.2

example  http4 route code:

    from("timer://foo?fixedRate=true&delay=0&period=10000")
    .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
    .setHeader(Exchange.HTTP_CHARACTER_ENCODING, constant("UTF-8"))
   
.to("log:httpbefore.SYSTEM.COM?level=DEBUG&ShowHeaders=true&ShowBody=true")
    .to("http4://SERVER-remote.com/services/status/54024")
   
.to("log:httpafter.SYSTEM.COM?level=DEBUG&ShowHeaders=true&ShowBody=true");
 
The Content Type and Character Encoding message headers are apparently being
filtered out.

Excerpt from Log with JSON Content Type IN message:

[                          main] RouteService                   DEBUG
Starting child service on route: route1 ->        
                                                                
Pipeline[[Channel[setHeader(Content-Type, application/json)], 
                                                                         
Channel[setHeader(CamelHttpCharacterEncoding, UTF-8)], 
                                                                         
Channel[sendTo(Endpoint[log://httpbefore.SYSTEM.COM?ShowBody=true&ShowHeaders=true&level=DEBUG])],         
                                                                         
Channel[sendTo(Endpoint[http4://server.remote.com/services/status/54024])], 
                                                                         
Channel[sendTo(Endpoint[log://httpafter.SYSTEM.COM?ShowBody=true&ShowHeaders=true&level=DEBUG])]]]


if you look at the outgoing >>  wire and headers lines you could see the
Content-Type is missing:

[mel-1) thread #0 - timer://foo] DefaultClientConnection        DEBUG
Sending request: GET /services/status/54024 HTTP/1.1
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"GET /services/status/54024 HTTP/1.1[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"firedTime: Thu Jan 23 14:05:49 EST             2014[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"breadcrumbId: ID-com-43559-     1390503945739-0-1[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"Host: SERVER-remote.com:443[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"Connection: Keep-Alive[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"[\r][\n]"
[mel-1) thread #0 - timer://foo] headers                        DEBUG >> GET
/services/status/54024 HTTP/1.1
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
firedTime: Thu Jan 23 14:05:49 EST 2014
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
breadcrumbId: ID-com-43559-      1390503945739-0-1
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
Host: SERVER-remote.com:443
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
Connection: Keep-Alive
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"HTTP/1.1 200 OK[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Cache-Control: private[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Content-Type: text/html[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Server: Microsoft-IIS/8.0[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"X-Powered-By: ServiceStack/3.962 Win32NT/.     NET[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Origin: *[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Methods: GET, POST, PUT,  DELETE, OPTIONS[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"X-AspNet-Version: 4.0.30319[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"X-Powered-By: ASP.NET[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Origin: *[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Headers: Content-         Type[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Methods: GET, POST, PUT,  DELETE, OPTIONS[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Date: Thu, 23 Jan 2014 19:05:51 GMT[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Content-Length: 9750[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"[\r][\n]"
[mel-1) thread #0 - timer://foo] DefaultClientConnection        DEBUG
Receiving response: HTTP/1.1 200 OK
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
HTTP/1.1 200 OK
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Cache-Control: private
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Content-Type: text/html
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Server: Microsoft-IIS/8.0
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
X-Powered-By: ServiceStack/3.962 Win32NT/.NET
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Origin: *
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Methods: GET, POST, PUT,   DELETE, OPTIONS
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
X-AspNet-Version: 4.0.30319
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
X-Powered-By: ASP.NET
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Origin: *
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Headers: Content-Type
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Methods: GET, POST, PUT,   DELETE, OPTIONS
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Date: Thu, 23 Jan 2014 19:05:51 GMT
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Content-Length: 9750
[mel-1) thread #0 - timer://foo] DefaultHttpClient              DEBUG
Connection can be kept alive indefinitely
[mel-1) thread #0 - timer://foo] HttpProducer                   DEBUG Http
responseCode: 200
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<!doctype html>[\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<html lang="en-us">[\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<head>[\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<title>RequestStatus Snapshot of 1/23/2014 7:  05:51 PM</title>[\n]"

is this expected behaviour? why Content-Type and Character-Encoding headers
being dropped.

do we need are they being filtered because of headerFilterStrategy option is
set to null.

does headerFilterStrategy when set to null filter out all setHeader?

if the issue is headerFilterStrategy, is there example code somewhere that
shows how not to filter out Content-Type.

thanks,

chasse



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

RE: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by alexey-s <al...@mail.ru>.
Look http://camel.apache.org/http4.html
Section: Message Headers.



Aleksey



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

RE: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by "E. A. English" <ee...@ikindi.com>.
Hi Ravi, 

Regarding your response below -

The question is: 

Why does header 

     Content-Type=application/json 

change to

     Content-Type=text/xml 

??? 

We need for "Content-Type=application/json" to be propragated to the
response. It seems to be somehow filtered, or otherwise changed to
"Content-Type=text/xml". 
How can this be accomplished?

Thanks very much for any help/suggestions, 
chasse

Your second logging will log headers from the response sent by the http4
invocation. I am able to see the values and these are not blanked out. 
 [mel-1) thread #0 - timer://foo] COMBEFORE DEBUG Exchange[ExchangePattern:
InOnly, Headers: {breadcrumbId=ID-LT005383-64443-1390555622180-0-1,
CamelHttpCharacterEncoding=UTF-8, Content-Type=application/json,
firedTime=Fri Jan 24 14:57:04 IST 2014}, BodyType: null, Body: [Body is
null]] [mel-1) thread #0 - timer://foo] COMAFTER DEBUG
Exchange[ExchangePattern: InOnly, Headers: {Age=0,
breadcrumbId=ID-LT005383-64443-1390555622180-0-1, Cache-Control=private,
CamelHttpCharacterEncoding=UTF-8, CamelHttpResponseCode=200,
Connection=keep-alive, Content-Length=132, Content-Type=text/xml;
charset=utf-8, Date=Fri, 24 Jan 2014 09:27:05 GMT, firedTime=Fri Jan 24
14:57:04 IST 2014, P3P=policyref="http://info.yahoo.com/w3c/p3p.xml",
CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi
SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA
PRE LOC GOV", Server=ATS, Vary=Accept-Encoding, Via=http/1.1
fts115.flickr.bf1.yahoo.com (ApacheTrafficServer/4.0.1 [cMsSf ]), http/1.1
r02.ycpi.inc.yahoo.net (ApacheTrafficServer/4.0.2 [cMsSf ]),
X-Served-By=www222.flickr.bf1.yahoo.com}, BodyType:
org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream,
Body: [Body is instance of java.io.InputStream]] 





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

Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by Willem Jiang <wi...@gmail.com>.
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 (sandeepreddip@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.
>  


Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by sandeepreddip <sa...@gmail.com>.
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.

Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by Willem Jiang <wi...@gmail.com>.
I just checked the code of camel-http and camel-http4, it is not possible the set the content-type header for the GET method. I suggest you to use the accept header instead.

--  
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 9:30:11 PM, sandeepreddip (sandeepreddip@gmail.com) wrote:
> I read the discussion at stack flow and would like to know how a GET request
> would be processed without content-type header with JAX-RS
>  
> According to RFC 2616 Fielding
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
>  
>  
> The definition of *Accept *header for the media types which are acceptable
> for the response by the client
> *Content-Type* entity-header field indicates the media type of the
> *entity-body* sent to the recipient or, in the case of the HEAD method, the
> media type that would have been sent had the request been a GET.
>  
> Looks like we indeed need a content-type header as part of GET.
>  
> JAX-RS
> @Consumes maps to the Content-Type Header
> @Produces maps to the Accept Header
>  
> http/http4 loses the Content-Type header in a GET. So, the request
> always fails. Is there a way to get around this? or for that matter is
> there a Camel component that solves it?
>  
> *In my case the mime type is strictly tied to application/*+xml*
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Http4-Set-Header-Content-Type-not-passing-through-to-the-HTTP-Request-tp5746414p5752955.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  


Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by sandeepreddip <sa...@gmail.com>.
I read the discussion at stack flow and would like to know how a  GET request
would be processed without content-type header  with JAX-RS

According to RFC 2616 Fielding  
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>  

The definition of *Accept *header for the media types which are acceptable
for the response by the client
*Content-Type* entity-header field indicates the media type of the
*entity-body* sent to the recipient or, in the case of the HEAD method, the
media type that would have been sent had the request been a GET. 

Looks like we indeed need a content-type header as part of GET.

JAX-RS 
@Consumes maps to the Content-Type Header
@Produces maps to the Accept Header

 http/http4 loses the Content-Type  header in a GET.  So, the  request
always fails. Is there a way to get around this?  or for that matter is
there a Camel component that solves it?

*In my case the mime type is strictly tied to application/*+xml*



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

Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by Willem Jiang <wi...@gmail.com>.
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.
>  


Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by sandeepreddip <sa...@gmail.com>.
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
<http://camel.465427.n5.nabble.com/file/n5752892/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.

Re: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by "kraythe ." <kr...@gmail.com>.
You generally don't want to use the OUT part of the exchange except in very
rare circumstances. I don't know why you felt the need to set the headers
and information on the out part of the exchange but that is almost always
an error. The rest of the route will continue processing the IN part of the
exchange and I am not sure what it will do with your out message. Id have
to enable the tracer and look at the log carefully to find out. A lot of
people new to camel get tripped up by the name "in" and "out" on the
exchanges. The reality is that 99% of all work in camel happens on the IN
part of the exchange and at the end of a route, whatever is in the IN part
gets interpreted by the endpoint for purposes of returning a reply to the
caller.

So, in short, set your headers on exchange.getIn() and try again. Also
enable the tracer.

Hope that helps.


*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Maintainable Java (Kindle
<http://www.amazon.com/Maintainable-Java-Robert-Simmons-Jr-ebook/dp/B00AKHI69K>)(iTunes
<https://itunes.apple.com/us/book/maintainable-java/id585666097?mt=11>)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Thu, Jun 26, 2014 at 8:15 AM, sandeepreddip <sa...@gmail.com>
wrote:

> Hi, I'm facing  the exact issue with an HTTP GET request. However it works
> fine with an HTTP POST.
>
> Camel version: 2.13.1
> RESTFul services built with RESTEasy 2.3.6
>
>
> Below are the logs for HTTP GET AND POST. *Enlightenment appreciated*.
>
>
> *HTTP POST ---FAILS -- Content-Type header is lost*
> The server responds with 415 as it wasn't able to find the Content-Type
> header, its actually *null* when the request hits the server.
>
> *JAVA DSL:*
> from("timer:foo?period=1000").process(new
> MessageProcessor()).to("http4://localhost:8080/cts-rest/cts/users").bean(
> CamelBeanBinding.class,"invokeMethod7");
>
>
>
> The *MessageProcessor *in the route adds the Headers shown below:
>
> @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("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);
>         }
>
> *See  below-- there is not outgoing Content-Type header *
>
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected:
> best-match
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in
> the context
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
> request: [route: {}->http://localhost:8080][total kept alive: 0; route
> allocated: 0 of 20; total allocated: 0 of 200]
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
> leased: [id: 0][route: {}->http://localhost:8080][total kept alive: 0;
> route
> allocated: 1 of 20; total allocated: 1 of 200]
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.execchain.MainClientExec  - Opening connection
> {}->http://localhost:8080
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.conn.HttpClientConnectionOperator  - Connecting to
> localhost/127.0.0.1:8080
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.conn.HttpClientConnectionOperator  - Connection
> established 127.0.0.1:57328<->127.0.0.1:8080
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.execchain.MainClientExec  - Executing request GET
> /cts-rest/cts/users HTTP/1.1
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.execchain.MainClientExec  - Target auth state:
> UNCHALLENGED
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.execchain.MainClientExec  - Proxy auth state:
> UNCHALLENGED
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> GET /cts-rest/cts/users HTTP/1.1
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Accept: application/*+xml
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> firedTime: Thu Jun 26 09:02:02 EDT 2014
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Accept-Language: en-US
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Content-Encoding: deflate
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> breadcrumbId: ID-sporeddy-57327-1403787720885-0-1
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Accept-Charset: utf-8
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Host: localhost:8080
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Connection: Keep-Alive
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> User-Agent: Apache-HttpClient/4.3.3 (java 1.5)
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 >> Accept-Encoding: gzip,deflate
> *[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "GET /cts-rest/cts/users HTTP/1.1[\r][\n]"*
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Accept: application/*+xml[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "firedTime: Thu Jun 26 09:02:02 EDT 2014[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Accept-Language: en-US[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Content-Encoding: deflate[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "breadcrumbId:
> ID-sporeddy-57327-1403787720885-0-1[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Accept-Charset: utf-8[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Host: localhost:8080[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.3.3 (java 1.5)[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 >> "[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "Server: Apache-Coyote/1.1[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "Content-Type: application/*+xml[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "Content-Length: 162[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "Date: Thu, 26 Jun 2014 13:02:08 GMT[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "[\r][\n]"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
> http-outgoing-0 << "<?xml version="1.0" encoding="UTF-8"
>
> standalone="yes"?><ErrorResponse><ErrorCode>415</ErrorCode><ErrorText>Cannot
> consume content type</ErrorText></ErrorResponse>"
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 << HTTP/1.1 415 Unsupported Media Type
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 << Server: Apache-Coyote/1.1
> *[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 << Content-Type: application/*+xml*
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 << Content-Length: 162
> [Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
> http-outgoing-0 << Date: Thu, 26 Jun 2014 13:02:08 GMT
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.execchain.MainClientExec  - Connection can be kept
> alive indefinitely
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
> [id: 0][route: {}->http://localhost:8080] can be kept alive indefinitely
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
> released: [id: 0][route: {}->http://localhost:8080][total kept alive: 1;
> route allocated: 1 of 20; total allocated: 1 of 200]
> [Camel (camel-1) thread #0 - timer://foo] DEBUG
> com.isone.oishe24.camel.jms.CamelBeanBinding  -  You have invoked the
> method2 HTTP operation failed invoking
> http://localhost:8080/cts-rest/cts/users with statusCode: 415
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection manager is shutting down
> [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection
>  -
> http-outgoing-0: Close connection
> [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection
>  -
> http-outgoing-0: Close connection
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection manager shut down
>
> *HTTP POST ---SUCESSFUL*
>
> *JAVA DSL ROUTE*
>
> from("direct:suspend").process(new
>
> MessageProcessor()).to("http4://localhost:8080/cts-rest/cts/ne/organizations").process(new
> CamelRestResponseProcessor()).bean(
> CamelBeanBinding.class,"invokeMethodRESTResponseMessage")
>
> [main] DEBUG org.apache.http.client.protocol.RequestAddCookies  -
> CookieSpec
> selected: best-match
> [main] DEBUG org.apache.http.client.protocol.RequestAuthCache  - Auth cache
> not set in the context
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection request: [route: {}->http://localhost:8080][total kept alive:
> 0;
> route allocated: 0 of 20; total allocated: 0 of 200]
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection leased: [id: 0][route: {}->http://localhost:8080][total kept
> alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
> [main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Opening
> connection {}->http://localhost:8080
> [main] DEBUG org.apache.http.impl.conn.HttpClientConnectionOperator  -
> Connecting to localhost/127.0.0.1:8080
> [main] DEBUG org.apache.http.impl.conn.HttpClientConnectionOperator  -
> Connection established 127.0.0.1:57314<->127.0.0.1:8080
> [main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Executing
> request POST /cts-rest/cts/ne/organizations HTTP/1.1
> [main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Target auth
> state: UNCHALLENGED
> [main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Proxy auth
> state: UNCHALLENGED
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> POST
> /cts-rest/cts/ne/organizations HTTP/1.1
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> breadcrumbId:
> ID-sporeddy-57313-1403787372489-0-1
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >>
> Content-Encoding:
> deflate
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept:
> application/*+xml
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept-Charset:
> utf-8
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept-Language:
> en-US
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Content-Length:
> 340
> *[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Content-Type:
> application/*+xml*
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Host:
> localhost:8080
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Connection:
> Keep-Alive
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> User-Agent:
> Apache-HttpClient/4.3.3 (java 1.5)
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept-Encoding:
> gzip,deflate
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "POST
> /cts-rest/cts/ne/organizations HTTP/1.1[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "breadcrumbId:
> ID-sporeddy-57313-1403787372489-0-1[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Content-Encoding:
> deflate[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept:
> application/*+xml[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept-Charset:
> utf-8[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept-Language:
> en-US[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Content-Length:
> 340[\r][\n]"
> *[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Content-Type:
> application/*+xml[\r][\n]"*
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Host:
> localhost:8080[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Connection:
> Keep-Alive[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "User-Agent:
> Apache-HttpClient/4.3.3 (java 1.5)[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept-Encoding:
> gzip,deflate[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "<?xml
> version="1.0"
> encoding="UTF-8"
>
> standalone="yes"?><SuspensionTerminationRequest><Header><SubmitterID>ISONE</SubmitterID><ReceiverID>NYISO</ReceiverID></Header><messageRequestID>1403787373229</messageRequestID><NEOrganizationID>4444</NEOrganizationID><NEOrganizationStatus>Suspended</NEOrganizationStatus></SuspensionTerminationRequest>"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 << "HTTP/1.1 201
> Created[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 << "Server:
> Apache-Coyote/1.1[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 << "Content-Length:
> 0[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 << "Date: Thu, 26 Jun
> 2014 12:56:23 GMT[\r][\n]"
> [main] DEBUG org.apache.http.wire  - http-outgoing-0 << "[\r][\n]"
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 << HTTP/1.1 201
> Created
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 << Server:
> Apache-Coyote/1.1
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 << Content-Length:
> 0
> [main] DEBUG org.apache.http.headers  - http-outgoing-0 << Date: Thu, 26
> Jun
> 2014 12:56:23 GMT
> [main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Connection
> can
> be kept alive indefinitely
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection [id: 0][route: {}->http://localhost:8080] can be kept alive
> indefinitely
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection released: [id: 0][route: {}->http://localhost:8080][total kept
> alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
>  Message Received HTTP Response ee {CamelHttpMethod=POST,
> CamelHttpResponseCode=201, Content-Length=0, Accept=application/*+xml,
> Server=Apache-Coyote/1.1, CamelHttpCharacterEncoding=UTF-8, Date=Thu, 26
> Jun
> 2014 12:56:23 GMT, Content-Encoding=deflate, Accept-Language=en-US,
> content-type=application/*+xml, Accept-Charset=utf-8,
> breadcrumbId=ID-sporeddy-57313-1403787372489-0-1}
> [main] DEBUG com.isone.oishe24.camel.jms.CamelBeanBinding  -  You have
> invoked the invokeMethodRESTResponseMessage 201
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection manager is shutting down
> [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection
>  -
> http-outgoing-0: Close connection
> [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection
>  -
> http-outgoing-0: Close connection
> [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager
>  -
> Connection manager shut down
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Http4-Set-Header-Content-Type-not-passing-through-to-the-HTTP-Request-tp5746414p5752856.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

RE: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by sandeepreddip <sa...@gmail.com>.
Hi, I'm facing  the exact issue with an HTTP GET request. However it works
fine with an HTTP POST.

Camel version: 2.13.1
RESTFul services built with RESTEasy 2.3.6


Below are the logs for HTTP GET AND POST. *Enlightenment appreciated*.


*HTTP POST ---FAILS -- Content-Type header is lost*
The server responds with 415 as it wasn't able to find the Content-Type
header, its actually *null* when the request hits the server.

*JAVA DSL:*
from("timer:foo?period=1000").process(new
MessageProcessor()).to("http4://localhost:8080/cts-rest/cts/users").bean(
CamelBeanBinding.class,"invokeMethod7");



The *MessageProcessor *in the route adds the Headers shown below:

@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("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);
	}

*See  below-- there is not outgoing Content-Type header *

[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.client.protocol.RequestAddCookies  - CookieSpec selected:
best-match
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.client.protocol.RequestAuthCache  - Auth cache not set in
the context
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
request: [route: {}->http://localhost:8080][total kept alive: 0; route
allocated: 0 of 20; total allocated: 0 of 200]
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
leased: [id: 0][route: {}->http://localhost:8080][total kept alive: 0; route
allocated: 1 of 20; total allocated: 1 of 200]
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.execchain.MainClientExec  - Opening connection
{}->http://localhost:8080
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.conn.HttpClientConnectionOperator  - Connecting to
localhost/127.0.0.1:8080
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.conn.HttpClientConnectionOperator  - Connection
established 127.0.0.1:57328<->127.0.0.1:8080
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.execchain.MainClientExec  - Executing request GET
/cts-rest/cts/users HTTP/1.1
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.execchain.MainClientExec  - Target auth state:
UNCHALLENGED
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.execchain.MainClientExec  - Proxy auth state:
UNCHALLENGED
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> GET /cts-rest/cts/users HTTP/1.1
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Accept: application/*+xml
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> firedTime: Thu Jun 26 09:02:02 EDT 2014
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Accept-Language: en-US
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Content-Encoding: deflate
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> breadcrumbId: ID-sporeddy-57327-1403787720885-0-1
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Accept-Charset: utf-8
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Host: localhost:8080
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Connection: Keep-Alive
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> User-Agent: Apache-HttpClient/4.3.3 (java 1.5)
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 >> Accept-Encoding: gzip,deflate
*[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "GET /cts-rest/cts/users HTTP/1.1[\r][\n]"*
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Accept: application/*+xml[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "firedTime: Thu Jun 26 09:02:02 EDT 2014[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Accept-Language: en-US[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Content-Encoding: deflate[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "breadcrumbId:
ID-sporeddy-57327-1403787720885-0-1[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Accept-Charset: utf-8[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Host: localhost:8080[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.3.3 (java 1.5)[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 >> "[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "HTTP/1.1 415 Unsupported Media Type[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "Server: Apache-Coyote/1.1[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "Content-Type: application/*+xml[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "Content-Length: 162[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "Date: Thu, 26 Jun 2014 13:02:08 GMT[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "[\r][\n]"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.wire  -
http-outgoing-0 << "<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><ErrorResponse><ErrorCode>415</ErrorCode><ErrorText>Cannot
consume content type</ErrorText></ErrorResponse>"
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 << HTTP/1.1 415 Unsupported Media Type
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 << Server: Apache-Coyote/1.1
*[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 << Content-Type: application/*+xml*
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 << Content-Length: 162
[Camel (camel-1) thread #0 - timer://foo] DEBUG org.apache.http.headers  -
http-outgoing-0 << Date: Thu, 26 Jun 2014 13:02:08 GMT
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.execchain.MainClientExec  - Connection can be kept
alive indefinitely
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
[id: 0][route: {}->http://localhost:8080] can be kept alive indefinitely
[Camel (camel-1) thread #0 - timer://foo] DEBUG
org.apache.http.impl.conn.PoolingHttpClientConnectionManager  - Connection
released: [id: 0][route: {}->http://localhost:8080][total kept alive: 1;
route allocated: 1 of 20; total allocated: 1 of 200]
[Camel (camel-1) thread #0 - timer://foo] DEBUG
com.isone.oishe24.camel.jms.CamelBeanBinding  -  You have invoked the
method2 HTTP operation failed invoking
http://localhost:8080/cts-rest/cts/users with statusCode: 415
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection manager is shutting down
[main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection  -
http-outgoing-0: Close connection
[main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection  -
http-outgoing-0: Close connection
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection manager shut down

*HTTP POST ---SUCESSFUL*

*JAVA DSL ROUTE*

from("direct:suspend").process(new
MessageProcessor()).to("http4://localhost:8080/cts-rest/cts/ne/organizations").process(new
CamelRestResponseProcessor()).bean(
CamelBeanBinding.class,"invokeMethodRESTResponseMessage")

[main] DEBUG org.apache.http.client.protocol.RequestAddCookies  - CookieSpec
selected: best-match
[main] DEBUG org.apache.http.client.protocol.RequestAuthCache  - Auth cache
not set in the context
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection request: [route: {}->http://localhost:8080][total kept alive: 0;
route allocated: 0 of 20; total allocated: 0 of 200]
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection leased: [id: 0][route: {}->http://localhost:8080][total kept
alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
[main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Opening
connection {}->http://localhost:8080
[main] DEBUG org.apache.http.impl.conn.HttpClientConnectionOperator  -
Connecting to localhost/127.0.0.1:8080
[main] DEBUG org.apache.http.impl.conn.HttpClientConnectionOperator  -
Connection established 127.0.0.1:57314<->127.0.0.1:8080
[main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Executing
request POST /cts-rest/cts/ne/organizations HTTP/1.1
[main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Target auth
state: UNCHALLENGED
[main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Proxy auth
state: UNCHALLENGED
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> POST
/cts-rest/cts/ne/organizations HTTP/1.1
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> breadcrumbId:
ID-sporeddy-57313-1403787372489-0-1
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Content-Encoding:
deflate
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept:
application/*+xml
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept-Charset:
utf-8
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept-Language:
en-US
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Content-Length:
340
*[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Content-Type:
application/*+xml*
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Host:
localhost:8080
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Connection:
Keep-Alive
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> User-Agent:
Apache-HttpClient/4.3.3 (java 1.5)
[main] DEBUG org.apache.http.headers  - http-outgoing-0 >> Accept-Encoding:
gzip,deflate
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "POST
/cts-rest/cts/ne/organizations HTTP/1.1[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "breadcrumbId:
ID-sporeddy-57313-1403787372489-0-1[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Content-Encoding:
deflate[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept:
application/*+xml[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept-Charset:
utf-8[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept-Language:
en-US[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Content-Length:
340[\r][\n]"
*[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Content-Type:
application/*+xml[\r][\n]"*
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Host:
localhost:8080[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Connection:
Keep-Alive[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "User-Agent:
Apache-HttpClient/4.3.3 (java 1.5)[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "Accept-Encoding:
gzip,deflate[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 >> "<?xml version="1.0"
encoding="UTF-8"
standalone="yes"?><SuspensionTerminationRequest><Header><SubmitterID>ISONE</SubmitterID><ReceiverID>NYISO</ReceiverID></Header><messageRequestID>1403787373229</messageRequestID><NEOrganizationID>4444</NEOrganizationID><NEOrganizationStatus>Suspended</NEOrganizationStatus></SuspensionTerminationRequest>"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 << "HTTP/1.1 201
Created[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 << "Server:
Apache-Coyote/1.1[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 << "Content-Length:
0[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 << "Date: Thu, 26 Jun
2014 12:56:23 GMT[\r][\n]"
[main] DEBUG org.apache.http.wire  - http-outgoing-0 << "[\r][\n]"
[main] DEBUG org.apache.http.headers  - http-outgoing-0 << HTTP/1.1 201
Created
[main] DEBUG org.apache.http.headers  - http-outgoing-0 << Server:
Apache-Coyote/1.1
[main] DEBUG org.apache.http.headers  - http-outgoing-0 << Content-Length: 0
[main] DEBUG org.apache.http.headers  - http-outgoing-0 << Date: Thu, 26 Jun
2014 12:56:23 GMT
[main] DEBUG org.apache.http.impl.execchain.MainClientExec  - Connection can
be kept alive indefinitely
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection [id: 0][route: {}->http://localhost:8080] can be kept alive
indefinitely
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection released: [id: 0][route: {}->http://localhost:8080][total kept
alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
 Message Received HTTP Response ee {CamelHttpMethod=POST,
CamelHttpResponseCode=201, Content-Length=0, Accept=application/*+xml,
Server=Apache-Coyote/1.1, CamelHttpCharacterEncoding=UTF-8, Date=Thu, 26 Jun
2014 12:56:23 GMT, Content-Encoding=deflate, Accept-Language=en-US,
content-type=application/*+xml, Accept-Charset=utf-8,
breadcrumbId=ID-sporeddy-57313-1403787372489-0-1}
[main] DEBUG com.isone.oishe24.camel.jms.CamelBeanBinding  -  You have
invoked the invokeMethodRESTResponseMessage 201
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection manager is shutting down
[main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection  -
http-outgoing-0: Close connection
[main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection  -
http-outgoing-0: Close connection
[main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager  -
Connection manager shut down



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

RE: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by "E. A. English" <ee...@ikindi.com>.
Hi Ravi,Regarding your response below:The question is:Why does header  
Content-Type=application/jsonchange to    Content-Type=text/xml???We need
for "Content-Type=application/json" to be propragated to the response.It
seems to be somehow filtered, or otherwise changed to
"Content-Type=text/xml"./Your second logging will log headers from the
response sent by the http4 invocation. I am able to see the values and these
are not blanked out./Thanks very much for any
help/suggestions,chasse/[mel-1) thread #0 - timer://foo] COMBEFORE                     
DEBUG Exchange[ExchangePattern: InOnly, Headers:
{breadcrumbId=ID-LT005383-64443-1390555622180-0-1,
CamelHttpCharacterEncoding=UTF-8, *Content-Type=application/json*,
firedTime=Fri Jan 24 14:57:04 IST 2014}, BodyType: null, Body: [Body is
null]][mel-1) thread #0 - timer://foo] COMAFTER                       DEBUG
Exchange[ExchangePattern: InOnly, Headers: {Age=0,
breadcrumbId=ID-LT005383-64443-1390555622180-0-1, Cache-Control=private,
CamelHttpCharacterEncoding=UTF-8, CamelHttpResponseCode=200,
Connection=keep-alive, *Content-Length=132, Content-Type=text/xml*;
charset=utf-8, Date=Fri, 24 Jan 2014 09:27:05 GMT, firedTime=Fri Jan 24
14:57:04 IST 2014, P3P=policyref="http://info.yahoo.com/w3c/p3p.xml",
CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi
SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA
PRE LOC GOV", Server=ATS, Vary=Accept-Encoding, Via=http/1.1
fts115.flickr.bf1.yahoo.com (ApacheTrafficServer/4.0.1 [cMsSf ]), http/1.1
r02.ycpi.inc.yahoo.net (ApacheTrafficServer/4.0.2 [cMsSf ]),
X-Served-By=www222.flickr.bf1.yahoo.com}, BodyType:
org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream,
Body: [Body is instance of java.io.InputStream]]/



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

RE: Http4 Set Header Content-Type not passing through to the HTTP Request

Posted by Ra...@cognizant.com.
Your second logging will log headers from the response sent by the http4 invocation. I am able to see the values and these are not blanked out.

Tried out with following path.

                                from("timer://foo?fixedRate=true&delay=0&period=1000")
                                                .setHeader(Exchange.CONTENT_TYPE,
                                                                constant("application/json"))
                                                .setHeader(Exchange.HTTP_CHARACTER_ENCODING,
                                                                constant("UTF-8"))
                                                .to(
                                                                "log:httpbefore.SYSTEM.COMBEFORE?level=DEBUG&ShowHeaders=true&ShowBody=true")
                                                .to("http4://api.flickr.com/services/rest/?method=flickr.test.echo&name=value")
                                                .to(
                                                                "log:httpafter.SYSTEM.COMAFTER?level=DEBUG&ShowHeaders=true&ShowBody=true");


[mel-1) thread #0 - timer://foo] COMBEFORE                      DEBUG Exchange[ExchangePattern: InOnly, Headers: {breadcrumbId=ID-LT005383-64443-1390555622180-0-1, CamelHttpCharacterEncoding=UTF-8, Content-Type=application/json, firedTime=Fri Jan 24 14:57:04 IST 2014}, BodyType: null, Body: [Body is null]]

[mel-1) thread #0 - timer://foo] COMAFTER                       DEBUG Exchange[ExchangePattern: InOnly, Headers: {Age=0, breadcrumbId=ID-LT005383-64443-1390555622180-0-1, Cache-Control=private, CamelHttpCharacterEncoding=UTF-8, CamelHttpResponseCode=200, Connection=keep-alive, Content-Length=132, Content-Type=text/xml; charset=utf-8, Date=Fri, 24 Jan 2014 09:27:05 GMT, firedTime=Fri Jan 24 14:57:04 IST 2014, P3P=policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV", Server=ATS, Vary=Accept-Encoding, Via=http/1.1 fts115.flickr.bf1.yahoo.com (ApacheTrafficServer/4.0.1 [cMsSf ]), http/1.1 r02.ycpi.inc.yahoo.net (ApacheTrafficServer/4.0.2 [cMsSf ]), X-Served-By=www222.flickr.bf1.yahoo.com}, BodyType: org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream, Body: [Body is instance of java.io.InputStream]]


- Ravi

-----Original Message-----
From: E. A. English [mailto:eenglish@ikindi.com]
Sent: Friday, January 24, 2014 12:59 AM
To: users@camel.apache.org
Subject: Http4 Set Header Content-Type not passing through to the HTTP Request

Hi,

setting the Content-type header for Http4 Camel Route - Message headers from
the IN message are not being copied to the OUT message

Using Camel Version 2.12.2

example  http4 route code:

    from("timer://foo?fixedRate=true&delay=0&period=10000")
    .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
    .setHeader(Exchange.HTTP_CHARACTER_ENCODING, constant("UTF-8"))

.to("log:httpbefore.SYSTEM.COM?level=DEBUG&ShowHeaders=true&ShowBody=true")
    .to("http4://SERVER-remote.com/services/status/54024")

.to("log:httpafter.SYSTEM.COM?level=DEBUG&ShowHeaders=true&ShowBody=true");

The Content Type and Character Encoding message headers are apparently being
filtered out.

Excerpt from Log with JSON Content Type IN message:

[                          main] RouteService                   DEBUG
Starting child service on route: route1 ->

Pipeline[[Channel[setHeader(Content-Type, application/json)],

Channel[setHeader(CamelHttpCharacterEncoding, UTF-8)],

Channel[sendTo(Endpoint[log://httpbefore.SYSTEM.COM?ShowBody=true&ShowHeaders=true&level=DEBUG])],

Channel[sendTo(Endpoint[http4://server.remote.com/services/status/54024])],

Channel[sendTo(Endpoint[log://httpafter.SYSTEM.COM?ShowBody=true&ShowHeaders=true&level=DEBUG])]]]


if you look at the outgoing >>  wire and headers lines you could see the
Content-Type is missing:

[mel-1) thread #0 - timer://foo] DefaultClientConnection        DEBUG
Sending request: GET /services/status/54024 HTTP/1.1
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"GET /services/status/54024 HTTP/1.1[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"firedTime: Thu Jan 23 14:05:49 EST             2014[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"breadcrumbId: ID-com-43559-     1390503945739-0-1[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"Host: SERVER-remote.com:443[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"Connection: Keep-Alive[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG >>
"[\r][\n]"
[mel-1) thread #0 - timer://foo] headers                        DEBUG >> GET
/services/status/54024 HTTP/1.1
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
firedTime: Thu Jan 23 14:05:49 EST 2014
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
breadcrumbId: ID-com-43559-      1390503945739-0-1
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
Host: SERVER-remote.com:443
[mel-1) thread #0 - timer://foo] headers                        DEBUG >>
Connection: Keep-Alive
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"HTTP/1.1 200 OK[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Cache-Control: private[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Content-Type: text/html[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Server: Microsoft-IIS/8.0[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"X-Powered-By: ServiceStack/3.962 Win32NT/.     NET[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Origin: *[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Methods: GET, POST, PUT,  DELETE, OPTIONS[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"X-AspNet-Version: 4.0.30319[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"X-Powered-By: ASP.NET[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Origin: *[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Headers: Content-         Type[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Access-Control-Allow-Methods: GET, POST, PUT,  DELETE, OPTIONS[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Date: Thu, 23 Jan 2014 19:05:51 GMT[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"Content-Length: 9750[\r][\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"[\r][\n]"
[mel-1) thread #0 - timer://foo] DefaultClientConnection        DEBUG
Receiving response: HTTP/1.1 200 OK
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
HTTP/1.1 200 OK
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Cache-Control: private
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Content-Type: text/html
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Server: Microsoft-IIS/8.0
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
X-Powered-By: ServiceStack/3.962 Win32NT/.NET
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Origin: *
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Methods: GET, POST, PUT,   DELETE, OPTIONS
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
X-AspNet-Version: 4.0.30319
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
X-Powered-By: ASP.NET
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Origin: *
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Headers: Content-Type
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Access-Control-Allow-Methods: GET, POST, PUT,   DELETE, OPTIONS
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Date: Thu, 23 Jan 2014 19:05:51 GMT
[mel-1) thread #0 - timer://foo] headers                        DEBUG <<
Content-Length: 9750
[mel-1) thread #0 - timer://foo] DefaultHttpClient              DEBUG
Connection can be kept alive indefinitely
[mel-1) thread #0 - timer://foo] HttpProducer                   DEBUG Http
responseCode: 200
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<!doctype html>[\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<html lang="en-us">[\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<head>[\n]"
[mel-1) thread #0 - timer://foo] wire                           DEBUG <<
"<title>RequestStatus Snapshot of 1/23/2014 7:  05:51 PM</title>[\n]"

is this expected behaviour? why Content-Type and Character-Encoding headers
being dropped.

do we need are they being filtered because of headerFilterStrategy option is
set to null.

does headerFilterStrategy when set to null filter out all setHeader?

if the issue is headerFilterStrategy, is there example code somewhere that
shows how not to filter out Content-Type.

thanks,

chasse



--
View this message in context: http://camel.465427.n5.nabble.com/Http4-Set-Header-Content-Type-not-passing-through-to-the-HTTP-Request-tp5746414.html
Sent from the Camel - Users mailing list archive at Nabble.com.
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.