camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: svn commit: r772054 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java
Date Thu, 07 May 2009 03:55:42 GMT
On Thu, May 7, 2009 at 5:02 AM, William Tam <email.wtam@gmail.com> wrote:
> On Wed, May 6, 2009 at 9:57 PM, Willem Jiang <willem.jiang@gmail.com> wrote:
>> Hi William,
>>
>> Since the JMS can't accept the header which's name has the '-'
>> character, we introduce the CamelTransportContants.CONTENT_TYPE for it.
>
> I thought JMS could not handle dots in header names (that's why we
> went from org.apache.camel convention to CamelHeaderName "case"
> convention).  My memory may be wrong.
Hi

In Camel 2.0 we have added to the JMS component so it will be able to
transfer Content-Type with the hyphen, as its a common header.
If you use Camel on both sides then it will automatic revert it back
to normal again. It replaces - with a _HYPHEN_ constant. So its
transfered as Content_HYPHEN_Type.

>
>>
>> After checking the on wire message between the client and CXF consumer,
>> I found there are two lines of "content-type" in the http header.
>> One is "content-type", the other is "Content-Type".
>
> The comment in code is kinda off.
>
>>
>> So I added the filter of "content-type", and keep using "content.type"
>> in the Camel message.
>>
>> Willem
>>
>>
>> William Tam wrote:
>>> Hi Willem,
>>>
>>> I don't think adding "content-type" to the filters is necessary.
>>> 1. The header is "Content-Type" not "content-type",  so the change
>>> does not really affect anything.
>>> 2. Putting that aside.  If we add filters for "Content-Type", it stops
>>> the propagating from Camel header to/from CXF header, which we don't
>>> want.
>>>
>>> We probably should clean up the use of
>>> CamelTransportContants.CONTENT_TYPE (value = content.type) and just
>>> use Message.CONTENT_TYPE (value  = Content-Type).
>>>
>>> In DefaultCxfBinding.java, I don't see why we need to invent a header
>>> constant (CamelTransportContants.CONTENT_TYPE) only used by camel-cxf
>>> and have to map it back and forth.
>>>
>>>
>>> That is, we can eliminate CamelTransportContants.CONTENT_TYPE and use
>>> Message.CONTENT_TYPE consistently in:
>>>
>>>         // propagate content type
>>>         String key = Message.CONTENT_TYPE;
>>>         Object value = cxfMessage.get(key);
>>>         if (value != null &&
>>> !headerFilterStrategy.applyFilterToExternalHeaders(key, value,
>>> exchange)) {
>>>             camelHeaders.put(CamelTransportConstants.CONTENT_TYPE, value);
>>>             if (LOG.isTraceEnabled()) {
>>>                 LOG.trace("Populate header from CXF header=" + key +
"
>>> value=" + value);
>>>             }
>>>         }
>>>
>>> ...
>>>             // put content type in exchange
>>>             if (CamelTransportConstants.CONTENT_TYPE.equals(entry.getKey()))
{
>>>                 cxfExchange.put(Message.CONTENT_TYPE, entry.getValue());
>>>                 continue;
>>>             }
>>>
>>> Thoughts?
>>>
>>> ==============================================================================
>>>> --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java
(original)
>>>> +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfHeaderFilterStrategy.java
Wed May  6 04:56:14 2009
>>>> @@ -63,6 +63,11 @@
>>>>         getOutFilter().add(Message.PROTOCOL_HEADERS);
>>>>         getInFilter().add(Message.PROTOCOL_HEADERS);
>>>>
>>>> +        // Since the DefaultCxfBinding deal with the content-type separately.
>>>> +        // We need to filter this header
>>>> +        getOutFilter().add("content-type");
>>>> +        getInFilter().add("content-type");
>>>> +
>>>>         // initialize message header filter map with default SOAP filter
>>>>         messageHeaderFiltersMap = new HashMap<String, MessageHeaderFilter>();
>>>>         addToMessageHeaderFilterMap(new SoapMessageHeaderFilter());
>>>>
>>>
>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration
Interview with me:
http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress

Mime
View raw message