You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Aki Yoshida (JIRA)" <ji...@apache.org> on 2013/05/24 14:06:20 UTC

[jira] [Created] (CAMEL-6393) Making header propagation from cxf to camel consistent

Aki Yoshida created CAMEL-6393:
----------------------------------

             Summary: Making header propagation from cxf to camel consistent
                 Key: CAMEL-6393
                 URL: https://issues.apache.org/jira/browse/CAMEL-6393
             Project: Camel
          Issue Type: Improvement
          Components: camel-cxf
    Affects Versions: 2.10.4
            Reporter: Aki Yoshida


This is a proposed solution to the header cxf to camel header propagation issue mentioned at
http://camel.465427.n5.nabble.com/propagating-multiple-header-entries-from-cxf-to-camel-td5732135.html

First, the current behavior is summarized as 
(using the notation "source" -> "destination" in the following)

When propagating from Camel to CXF
DefaultCxfBinding's propagate method works as 
List -> List
String -> List containing String

CxfHeaderHelper's propagate method works as
Object -> List containing Object.toString()

When propagating from CXF to Camel
Both DefaultCxfBinding's and CxfHeaderHelper's propagate methods work as
List -> String corresponding to List.get(0)

The proposed behavior will be summarized as follows:

We introduce a boolean property CxfProtocolHeadersMerged in camel exchange.

Propagating from Camel to CXF
List -> List
String -> List containing String

Propagating from CXF to Camel
if CxfProtocolHeadersMerged is true
List with one String-> String
List with more than one Strings -> String corresponding to the merged strings
if CxtProtocolHeadersMerged is false
List with one String -> String
List with more than one Strings -> List

When CxfProtocolHeadersMerged is set to false, the propagation behavior from cxf to camel and camel to cxf is symmetric. A single value header is treated as string in camel, whereas a multiple values header is treated as a list. When CxfProtocolHeadersMerged is set to true, both types of headers are treated as strings in camel.

I think setting the default value of CxfProtocolHeadersMerged to false is more appealing. Although setting the default value to true makes the behavior resemble to the current behavior of having always string valued headers when the headers are propagated from cxf to camel, this behavior is asymmetric and somehow inconsistent, as camel still allows a header with multiple values. 

In contrast, setting the default value to false creates a symmetric behavior in propagating headers of single or multiple values across the camel cxf boarder. And as most headers are single valued, this behavior remains identical to the current behavior for those single valued headers.

I am attaching the patch here.

I modified both DefaultCxfBinding and CxfHeaderHelper without consolidating/reusing one code in the other. I suppose this part is in the middle of consolidation and as such, I kept it as it is.

The test cases included.
Also corrected is the assertion's equals' ordering in somme existing test case ("expected value", "test value") to get the error log printed correctly.

Please have a look at the change.

Thanks.

aki

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira