Return-Path: X-Original-To: apmail-camel-dev-archive@www.apache.org Delivered-To: apmail-camel-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F36691754C for ; Sat, 27 Sep 2014 21:51:50 +0000 (UTC) Received: (qmail 9204 invoked by uid 500); 27 Sep 2014 21:51:49 -0000 Delivered-To: apmail-camel-dev-archive@camel.apache.org Received: (qmail 9159 invoked by uid 500); 27 Sep 2014 21:51:49 -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 9148 invoked by uid 99); 27 Sep 2014 21:51:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Sep 2014 21:51:49 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Sep 2014 21:51:24 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1XXzth-0007n7-Tu for dev@camel.apache.org; Sat, 27 Sep 2014 14:51:22 -0700 Date: Sat, 27 Sep 2014 14:51:21 -0700 (PDT) From: Babak Vahdat To: dev@camel.apache.org Message-ID: <1411854681913-5757113.post@n5.nabble.com> In-Reply-To: References: <4C1FB9DC-7056-4165-A96D-F693E3E3C7D0@apache.org> <46647C99-EB30-44CF-AFFE-F2B66813F7F3@apache.org> <5422CB70.7000203@gmail.com> Subject: Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Willem, I guess the naming of the setter method is wrong (doesn=E2=80=99t adhere th= e Java bean style) which=E2=80=99s why we do currently fail to invoke it through o= ur IntrospectionSupport utility when it=E2=80=99s given through an URI option: https://github.com/apache/camel/commit/53792cc1cf4c45f3fae6d8cc84a3b15fb12c= c05a#diff-154901a934ad9ebad992c3fa1e8bbcbaR409 This is exactly why this setter doesn=E2=80=99t get invoked at all although= you set it as an URI option below https://github.com/apache/camel/commit/53792cc1cf4c45f3fae6d8cc84a3b15fb12c= c05a#diff-cca41fa34076a43d0940e4366508432dR67 Also the ticket is marked as fixed but I didn't find this option being enlisted http://camel.apache.org/cxfrs.html Babak Willem.Jiang wrote > I can add an option to cxfrs endpoint to avoid sending the payload in > DELETE method. In this way, we could keep old behaviour of CxfProducer > unchanged by default. >=20 > Any thoughts?=C2=A0 >=20 >=20 > -- =20 > Willem Jiang >=20 > Red Hat, Inc. > Web: http://www.redhat.com > Blog: http://willemjiang.blogspot.com (English) > http://jnn.iteye.com (Chinese) > Twitter: willemjiang =20 > Weibo: =E5=A7=9C=E5=AE=81willem >=20 >=20 >=20 > On September 24, 2014 at 9:47:58 PM, Sergey Beryozkin ( > sberyozkin@ > ) wrote: >> Hi Dan, Willem >> On 24/09/14 14:37, Daniel Kulp wrote: >> > >> > That=E2=80=99s likely a different issue. Nt sure the parameter should = be added >> as part of the =20 >> body in this case as part of the consumer. I=E2=80=99d defer that to Ser= gey, but >> certainly the CxfProducer =20 >> needs to be able to send a DELETE with a payload. >> > >> It is indeed the case of the client proxy unintentionally picking up a >> payload and using it in DELETE, so indeed it is about the optional >> payload exclusion as opposed to completely blocking the client to avoid >> sending payloads with DELETE >> =20 >> Willem, IMHO this should be optional >> =20 >> Thanks, Sergey >> =20 >> > Dan >> > >> > >> > >> > On Sep 24, 2014, at 9:24 AM, Willem Jiang wrote: >> > >> >> Actually, this patch is try to avoid sending the message body with th= e >> DELETE method =20 >> if camel proxy the request just like this >> >> >> >> =20 >> >> =20 >> >> =20 >> >> >> >> As camel-cxfrs consumer put the invocation parameters into the camel >> message body, =20 >> the proxy just add the message body 124 like this >> >> >> >> 2014-09-24 21:00:19,378 [qtp841166421-29] INFO LoggingInInterceptor - >> Inbound =20 >> Message >> >> ---------------------------- >> >> ID: 11 >> >> Address: >> http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/12= 4/ =20 >> >> Http-Method: DELETE >> >> Content-Type: >> >> Headers: {accept-encoding=3D[gzip,deflate], connection=3D[keep-alive]= , >> Content-Type=3D[null], =20 >> Host=3D[localhost:1101], User-Agent=3D[Apache-HttpClient/4.3.3 (java 1.5= )]} >> >> -------------------------------------- >> >> 2014-09-24 21:00:19,380 [qtp841166421-29] INFO body - >> Exchange[ExchangePattern: =20 >> InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124] >> >> 2014-09-24 21:00:19,385 [qtp841166421-29] INFO LoggingOutInterceptor = - >> Outbound =20 >> Message >> >> --------------------------- >> >> ID: 12 >> >> Address: >> http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124= / =20 >> >> Http-Method: DELETE >> >> Content-Type: application/xml >> >> Headers: {Host=3D[localhost:1101], >> org.apache.cxf.request.method=3D[DELETE], =20 >> accept-encoding=3D[gzip,deflate], connection=3D[keep-alive], >> org.apache.cxf.message.Message.PATH_INFO=3D[/customerservice/customers/1= 24/], =20 >> breadcrumbId=3D[ID-localhost-51196-1411563616702-4-3], Accept=3D[*/*], >> org.apache.cxf.request.uri=3D[/CxfRsRouterTest/route/customerservice/cus= tomers/124/], =20 >> User-Agent=3D[Apache-HttpClient/4.3.3 (java 1.5)], >> Content-Type=3D[application/xml]} =20 >> >> Payload: 124 >> >> >> >> If we remove the message body in the application level (in the camel >> route), the camel =20 >> route could be more complex as it need to know the underlay http request >> method. >> >> >> >> That is the reason that I create this JIRA to apply the best practise >> here. >> >> >> >> >> >> >> >> -- >> >> Willem Jiang >> >> >> >> Red Hat, Inc. >> >> Web: http://www.redhat.com >> >> Blog: http://willemjiang.blogspot.com (English) >> >> http://jnn.iteye.com (Chinese) >> >> Twitter: willemjiang >> >> Weibo: =E5=A7=9C=E5=AE=81willem >> >> >> >> >> >> >> >> On September 24, 2014 at 7:49:26 PM, Daniel Kulp ( > dkulp@ > ) wrote: >> >>> >> >>> Willem, >> >>> >> >>> My reading of the discussion is that a DELETE MAY contain a message >> body, but the semantics =20 >> >>> are somewhat undefined. A proxy SHOULD forward that body on. This >> commit seems to =20 >> make >> >>> sure it doesn=E2=80=99t forward it along. Thus, I=E2=80=99m kind of = against this >> commit. >> >>> >> >>> We also had a discussion about this on the CXF list a while ago wher= e >> the body was needed: =20 >> >>> >> >>> >> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-wit= h-JAXRSClientFactoryBean-tt5735129.html =20 >> >>> >> >>> >> >>> >> >>> Dan >> >>> >> >>> >> >>> >> >>> On Sep 24, 2014, at 1:44 AM,=20 > ningjiang@ > wrote: >> >>> >> >>>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message >> body when using =20 >> >>> DELETE method >> >>>> >> >>>> >> >>>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo >> >>>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb6= 1 =20 >> >>>> Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5b4abb61 >> >>>> Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5b4abb61 >> >>>> >> >>>> Branch: refs/heads/camel-2.13.x >> >>>> Commit: 5b4abb619b808d317da99037b734e78fc4398d29 >> >>>> Parents: 2b1296e >> >>>> Author: Willem Jiang >> >>>> Authored: Wed Sep 24 13:41:41 2014 +0800 >> >>>> Committer: Willem Jiang >> >>>> Committed: Wed Sep 24 13:43:43 2014 +0800 >> >>>> >> >>>> >> ---------------------------------------------------------------------- = =20 >> >>>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | = 4 >> ++-- =20 >> >>>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 = + >> >>>> 2 files changed, 3 insertions(+), 2 deletions(-) >> >>>> >> ---------------------------------------------------------------------- = =20 >> >>>> >> >>>> >> >>>> >> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/ca= mel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.ja= va =20 >> >>>> >> ---------------------------------------------------------------------- = =20 >> >>>> diff --git >> a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxr= s/CxfRsProducer.java =20 >> >>> >> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxr= s/CxfRsProducer.java =20 >> >>>> index 572e991..c580445 100644 >> >>>> --- >> a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxr= s/CxfRsProducer.java =20 >> >>>> +++ >> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxr= s/CxfRsProducer.java =20 >> >>>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends >> DefaultProducer { >> >>>> >> >>>> // set the body >> >>>> Object body =3D null; >> >>>> - if (!"GET".equals(httpMethod)) { >> >>>> - // need to check the request object. >> >>>> + if (!"GET".equals(httpMethod) && !"DELETE".equals(httpMethod)) { >> >>>> + // need to check the request object if the http Method is not GET >> or DELETE >> >>>> body =3D binding.bindCamelMessageBodyToRequestBody(inMessage, >> exchange); =20 >> >>>> if (LOG.isTraceEnabled()) { >> >>>> LOG.trace("Request body =3D " + body); >> >>>> >> >>>> >> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/ca= mel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpring= Router.xml =20 >> >>>> >> ---------------------------------------------------------------------- = =20 >> >>>> diff --git >> a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf= /jaxrs/CxfRsSpringRouter.xml =20 >> >>> >> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf= /jaxrs/CxfRsSpringRouter.xml =20 >> >>>> index 154b572..9f51dd6 100644 >> >>>> --- >> a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf= /jaxrs/CxfRsSpringRouter.xml =20 >> >>>> +++ >> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf= /jaxrs/CxfRsSpringRouter.xml =20 >> >>>> @@ -64,6 +64,7 @@ >> >>>> >> >>>> >> >>>> >> >>>> + >> >>>> >> >>>> >> >>>> True >> >>>> >> >>> >> >>> -- >> >>> Daniel Kulp >> >>>=20 > dkulp@ > - http://dankulp.com/blog >> >>> Talend Community Coder - http://coders.talend.com >> > >> =20 >> -- View this message in context: http://camel.465427.n5.nabble.com/Re-2-3-git-= commit-CAMEL-7856-camel-cxf-producer-HttpAPI-should-not-send-the-message-bo= dy-when-using-d-tp5756960p5757113.html Sent from the Camel Development mailing list archive at Nabble.com.