Hi William,

Since the JMS can't accept the header which's name has the '-'
character, we introduce the CamelTransportContants.CONTENT_TYPE for it.

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".

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());
>>
> 

Reply via email to