Return-Path: Delivered-To: apmail-camel-dev-archive@www.apache.org Received: (qmail 3293 invoked from network); 7 May 2009 04:01:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 May 2009 04:01:53 -0000 Received: (qmail 49980 invoked by uid 500); 7 May 2009 04:01:53 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 49928 invoked by uid 500); 7 May 2009 04:01:53 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 49917 invoked by uid 99); 7 May 2009 04:01:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 04:01:53 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.220.177 as permitted sender) Received: from [209.85.220.177] (HELO mail-fx0-f177.google.com) (209.85.220.177) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 04:01:43 +0000 Received: by fxm25 with SMTP id 25so541240fxm.20 for ; Wed, 06 May 2009 21:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=f872q0abkk57UJEOLNQQy2djN1G1MVzisdhiO0JT3bk=; b=lkPDj/V3h068mjXSnBJ6yQ3e/zd4JT9mQNu++wpPIb3B1/FnnXB2AClcqEf997z9w6 XzwsoPF729KzSNVF4RLDxECjAJyZaRRIDjDjlfEV99D+V7uCtDdgqOB+/xsGgsQePQ2D dl96V/WaNke1RLZC/dfVYWWLeFlWQy7D/Zfog= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=ETai8fOxlWP9haJ60QC/HIJSsTQ/C1jV/MYV1+LuhZaHF6Oo8AoBBR5kBU789epT+s 0cQoRBEXt40crzYKkmeQLhL4W9gZDGeNDrDTAv0rVolb9LTg7WCJjecbFTogjW+BCueT VB1qfTeJnTqAbkckaZwXGCZm3Z6UYMApAMBVU= MIME-Version: 1.0 Received: by 10.223.107.135 with SMTP id b7mr1319686fap.30.1241668563198; Wed, 06 May 2009 20:56:03 -0700 (PDT) In-Reply-To: References: <20090506045615.3C933238896B@eris.apache.org> <4A023FF8.2090309@gmail.com> From: Claus Ibsen Date: Thu, 7 May 2009 05:55:42 +0200 Message-ID: <5380c69c0905062055p71f3ec74q1d32ce49b5b77933@mail.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 To: dev@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Thu, May 7, 2009 at 5:02 AM, William Tam wrote: > On Wed, May 6, 2009 at 9:57 PM, Willem Jiang wro= te: >> 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). =A0My 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", =A0so the change >>> does not really affect anything. >>> 2. Putting that aside. =A0If we add filters for "Content-Type", it stop= s >>> 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 =3D content.type) and just >>> use Message.CONTENT_TYPE (value =A0=3D 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: >>> >>> =A0 =A0 =A0 =A0 // propagate content type >>> =A0 =A0 =A0 =A0 String key =3D Message.CONTENT_TYPE; >>> =A0 =A0 =A0 =A0 Object value =3D cxfMessage.get(key); >>> =A0 =A0 =A0 =A0 if (value !=3D null && >>> !headerFilterStrategy.applyFilterToExternalHeaders(key, value, >>> exchange)) { >>> =A0 =A0 =A0 =A0 =A0 =A0 camelHeaders.put(CamelTransportConstants.CONTEN= T_TYPE, value); >>> =A0 =A0 =A0 =A0 =A0 =A0 if (LOG.isTraceEnabled()) { >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 LOG.trace("Populate header from CXF hea= der=3D" + key + " >>> value=3D" + value); >>> =A0 =A0 =A0 =A0 =A0 =A0 } >>> =A0 =A0 =A0 =A0 } >>> >>> ... >>> =A0 =A0 =A0 =A0 =A0 =A0 // put content type in exchange >>> =A0 =A0 =A0 =A0 =A0 =A0 if (CamelTransportConstants.CONTENT_TYPE.equals= (entry.getKey())) { >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cxfExchange.put(Message.CONTENT_TYPE, e= ntry.getValue()); >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 continue; >>> =A0 =A0 =A0 =A0 =A0 =A0 } >>> >>> Thoughts? >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/co= mponent/cxf/CxfHeaderFilterStrategy.java (original) >>>> +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/co= mponent/cxf/CxfHeaderFilterStrategy.java Wed May =A06 04:56:14 2009 >>>> @@ -63,6 +63,11 @@ >>>> =A0 =A0 =A0 =A0 getOutFilter().add(Message.PROTOCOL_HEADERS); >>>> =A0 =A0 =A0 =A0 getInFilter().add(Message.PROTOCOL_HEADERS); >>>> >>>> + =A0 =A0 =A0 =A0// Since the DefaultCxfBinding deal with the content-= type separately. >>>> + =A0 =A0 =A0 =A0// We need to filter this header >>>> + =A0 =A0 =A0 =A0getOutFilter().add("content-type"); >>>> + =A0 =A0 =A0 =A0getInFilter().add("content-type"); >>>> + >>>> =A0 =A0 =A0 =A0 // initialize message header filter map with default S= OAP filter >>>> =A0 =A0 =A0 =A0 messageHeaderFiltersMap =3D new HashMap(); >>>> =A0 =A0 =A0 =A0 addToMessageHeaderFilterMap(new SoapMessageHeaderFilte= r()); >>>> >>> >> >> > --=20 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=3D7893-= progress