camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siano, Stephan" <stephan.si...@sap.com>
Subject RE: Expected behaviour of camel-ahc component concerning headers
Date Tue, 15 Apr 2014 05:14:36 GMT
Hi,

I have looked up some other components doing HTTP communication like camel-http4 and camel-cxf
and these components do copy the headers. I also found a unit test for copying these headers,
so I assume that the documented behavior is the expected one. Unfortunately this unit test
contained a bug, so it didn't find the bug in the component. I created a JIRA bug (https://issues.apache.org/jira/browse/CAMEL-7363)
and attached a rather trivial patch to it (one line for the test and one line for the component...).

Best regards
Stephan

-----Original Message-----
From: Siano, Stephan [mailto:stephan.siano@sap.com] 
Sent: Montag, 7. April 2014 15:17
To: dev@camel.apache.org
Subject: Expected behaviour of camel-ahc component concerning headers

Hi,

The documentation of the camel-ahc component (http://camel.apache.org/ahc.html ) says:

"Message Body

Camel will store the HTTP response from the external server on the OUT body. All headers from
the IN message will be copied to the OUT message, so headers are preserved during routing.
Additionally Camel will add the HTTP response headers as well to the OUT message headers."

However this is not how it is implemented:
A new (empty) DefaultMessage will be created in the DefaultAhcBinding.onStatusReceived() method
by calling exchange.getOut(). Afterwards only the HTTP-Response and the incoming HTTP headers
are set to the out message. I discussed this with Aki Yoshida and he believes that the implemented
behavior is the correct one as otherwise request and response messages would be mixed.

>From my perspective both approaches make sense, however the documentation and the implementation
should match. So either the line (exchange.getOut().setHeaders(exchange.getIn().getAllHeaders());)
should be added to the DefaultBinding.onStatusReceived() method, or the documentation should
be adapted like "... OUT body. Camel will replace the OUT message headers by the HTTP response
headers, so headers are not preserved during routing."

What do you think.

Best regards
Stephan

Mime
View raw message