Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

dkulp@apache.org

Willem,

My reading of the discussion is that a DELETE MAY contain a message body, but the semantics are somewhat undefined.   A proxy SHOULD forward that body on.   This commit seems to make sure it doesn’t forward it along.    Thus, I’m kind of against this commit.

We also had a discussion about this on the CXF list a while ago where the body was needed:

http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html



Dan



On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:

> CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method
>
>
> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61
> 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 <[hidden email]>
> Authored: Wed Sep 24 13:41:41 2014 +0800
> Committer: Willem Jiang <[hidden email]>
> Committed: Wed Sep 24 13:43:43 2014 +0800
>
> ----------------------------------------------------------------------
> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--
> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml   | 1 +
> 2 files changed, 3 insertions(+), 2 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
> ----------------------------------------------------------------------
> diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
> index 572e991..c580445 100644
> --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
> +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
> @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
>
>         // set the body
>         Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
>             if (LOG.isTraceEnabled()) {
>                 LOG.trace("Request body = " + body);
>
> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
> ----------------------------------------------------------------------
> diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
> index 154b572..9f51dd6 100644
> --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
> +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
> @@ -64,6 +64,7 @@
>   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>     <route>
>        <from uri="cxfrs://bean://rsServer"/>
> +       <to uri="log:body?level=INFO"/>
>        <!-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -->
>        <setHeader headerName="CamelCxfRsUsingHttpAPI">
>          <constant>True</constant>        
>

--
Daniel Kulp
[hidden email] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

Sergey Beryozkin
Hi,

Indeed - we've had several users complaining they can not use CXF Http
clients to use DELETE and the body against the legacy servers written to
expect DELETE and the body.
Enforcing the best practice at the component level would inevitably make
this component less practical, it should be managed at the application level

Thanks, Sergey

On 24/09/14 12:48, Daniel Kulp wrote:

>
> Willem,
>
> My reading of the discussion is that a DELETE MAY contain a message body, but the semantics are somewhat undefined.   A proxy SHOULD forward that body on.   This commit seems to make sure it doesn’t forward it along.    Thus, I’m kind of against this commit.
>
> We also had a discussion about this on the CXF list a while ago where the body was needed:
>
> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html
>
>
>
> Dan
>
>
>
> On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:
>
>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61
>> 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 <[hidden email]>
>> Authored: Wed Sep 24 13:41:41 2014 +0800
>> Committer: Willem Jiang <[hidden email]>
>> Committed: Wed Sep 24 13:43:43 2014 +0800
>>
>> ----------------------------------------------------------------------
>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--
>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml   | 1 +
>> 2 files changed, 3 insertions(+), 2 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>> ----------------------------------------------------------------------
>> diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>> index 572e991..c580445 100644
>> --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>> +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
>>
>>          // set the body
>>          Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
>>              if (LOG.isTraceEnabled()) {
>>                  LOG.trace("Request body = " + body);
>>
>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>> ----------------------------------------------------------------------
>> diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>> index 154b572..9f51dd6 100644
>> --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>> +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>> @@ -64,6 +64,7 @@
>>    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>>      <route>
>>         <from uri="cxfrs://bean://rsServer"/>
>> +       <to uri="log:body?level=INFO"/>
>>         <!-- We can remove this configure as the CXFRS producer is using the HttpAPI by default -->
>>         <setHeader headerName="CamelCxfRsUsingHttpAPI">
>>           <constant>True</constant>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

Willem.Jiang
Administrator
In reply to this post by dkulp@apache.org
Actually, this patch is try to avoid sending the message body with the DELETE method if camel proxy the request just like this
 
 <from uri="cxfrs://bean://rsServer"/>
 <to uri="log:body?level=INFO"/>
 <to uri="cxfrs://bean://rsClient"/> 

As camel-cxfrs consumer put the invocation parameters into the camel message body, the proxy just add the message body 124 like this

2014-09-24 21:00:19,378 [qtp841166421-29] INFO  LoggingInInterceptor           - Inbound Message
----------------------------
ID: 11
Address: http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/124/
Http-Method: DELETE
Content-Type: 
Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Type=[null], Host=[localhost:1101], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)]}
--------------------------------------
2014-09-24 21:00:19,380 [qtp841166421-29] INFO  body                           - Exchange[ExchangePattern: InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124]
2014-09-24 21:00:19,385 [qtp841166421-29] INFO  LoggingOutInterceptor          - Outbound Message
---------------------------
ID: 12
Address: http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124/
Http-Method: DELETE
Content-Type: application/xml
Headers: {Host=[localhost:1101], org.apache.cxf.request.method=[DELETE], accept-encoding=[gzip,deflate], connection=[keep-alive], org.apache.cxf.message.Message.PATH_INFO=[/customerservice/customers/124/], breadcrumbId=[ID-localhost-51196-1411563616702-4-3], Accept=[*/*], org.apache.cxf.request.uri=[/CxfRsRouterTest/route/customerservice/customers/124/], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)], Content-Type=[application/xml]}
Payload: 124  

If we remove the message body in the application level (in the camel route), the camel 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: 姜宁willem



On September 24, 2014 at 7:49:26 PM, Daniel Kulp ([hidden email]) wrote:

>  
> Willem,
>  
> My reading of the discussion is that a DELETE MAY contain a message body, but the semantics  
> are somewhat undefined. A proxy SHOULD forward that body on. This commit seems to make  
> sure it doesn’t forward it along. Thus, I’m kind of against this commit.
>  
> We also had a discussion about this on the CXF list a while ago where the body was needed:  
>  
> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html 
>  
>  
>  
> Dan
>  
>  
>  
> On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:
>  
> > CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using  
> DELETE method
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61
> > 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
> >
> > ----------------------------------------------------------------------  
> > .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--  
> > .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +
> > 2 files changed, 3 insertions(+), 2 deletions(-)
> > ----------------------------------------------------------------------  
> >
> >
> > http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java 
> > ----------------------------------------------------------------------  
> > diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> > index 572e991..c580445 100644
> > --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> > +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> > @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
> >
> > // set the body
> > Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
> > if (LOG.isTraceEnabled()) {
> > LOG.trace("Request body = " + body);
> >
> > http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml 
> > ----------------------------------------------------------------------  
> > diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> > index 154b572..9f51dd6 100644
> > --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> > +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> > @@ -64,6 +64,7 @@
> >  
> >  
> >  
> > +  
> >  
> >  
> > True
> >
>  
> --
> Daniel Kulp
> [hidden email] - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>  
>  

Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

dkulp@apache.org

That’s likely a different issue.   Nt sure the parameter should be added as part of the body in this case as part of the consumer.  I’d defer that to Sergey, but certainly the CxfProducer needs to be able to send a DELETE with a payload.

Dan



On Sep 24, 2014, at 9:24 AM, Willem Jiang <[hidden email]> wrote:

> Actually, this patch is try to avoid sending the message body with the DELETE method if camel proxy the request just like this
>  
>  <from uri="cxfrs://bean://rsServer"/>
>  <to uri="log:body?level=INFO"/>
>  <to uri="cxfrs://bean://rsClient"/>
>
> As camel-cxfrs consumer put the invocation parameters into the camel message body, the proxy just add the message body 124 like this
>
> 2014-09-24 21:00:19,378 [qtp841166421-29] INFO  LoggingInInterceptor           - Inbound Message
> ----------------------------
> ID: 11
> Address: http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/124/
> Http-Method: DELETE
> Content-Type:
> Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Type=[null], Host=[localhost:1101], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)]}
> --------------------------------------
> 2014-09-24 21:00:19,380 [qtp841166421-29] INFO  body                           - Exchange[ExchangePattern: InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124]
> 2014-09-24 21:00:19,385 [qtp841166421-29] INFO  LoggingOutInterceptor          - Outbound Message
> ---------------------------
> ID: 12
> Address: http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124/
> Http-Method: DELETE
> Content-Type: application/xml
> Headers: {Host=[localhost:1101], org.apache.cxf.request.method=[DELETE], accept-encoding=[gzip,deflate], connection=[keep-alive], org.apache.cxf.message.Message.PATH_INFO=[/customerservice/customers/124/], breadcrumbId=[ID-localhost-51196-1411563616702-4-3], Accept=[*/*], org.apache.cxf.request.uri=[/CxfRsRouterTest/route/customerservice/customers/124/], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)], Content-Type=[application/xml]}
> Payload: 124  
>
> If we remove the message body in the application level (in the camel route), the camel 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: 姜宁willem
>
>
>
> On September 24, 2014 at 7:49:26 PM, Daniel Kulp ([hidden email]) wrote:
>>
>> Willem,
>>
>> My reading of the discussion is that a DELETE MAY contain a message body, but the semantics  
>> are somewhat undefined. A proxy SHOULD forward that body on. This commit seems to make  
>> sure it doesn’t forward it along. Thus, I’m kind of against this commit.
>>
>> We also had a discussion about this on the CXF list a while ago where the body was needed:  
>>
>> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html 
>>
>>
>>
>> Dan
>>
>>
>>
>> On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:
>>
>>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using  
>> DELETE method
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61
>>> 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
>>>
>>> ----------------------------------------------------------------------  
>>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--  
>>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +
>>> 2 files changed, 3 insertions(+), 2 deletions(-)
>>> ----------------------------------------------------------------------  
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java 
>>> ----------------------------------------------------------------------  
>>> diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
>> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
>>> index 572e991..c580445 100644
>>> --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
>>> +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
>>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
>>>
>>> // set the body
>>> Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
>>> if (LOG.isTraceEnabled()) {
>>> LOG.trace("Request body = " + body);
>>>
>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml 
>>> ----------------------------------------------------------------------  
>>> diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
>> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
>>> index 154b572..9f51dd6 100644
>>> --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
>>> +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
>>> @@ -64,6 +64,7 @@
>>>
>>>
>>>
>>> +  
>>>
>>>
>>> True
>>>
>>
>> --
>> Daniel Kulp
>> [hidden email] - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com

--
Daniel Kulp
[hidden email] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

Sergey Beryozkin
Hi Dan, Willem
On 24/09/14 14:37, Daniel Kulp wrote:
>
> That’s likely a different issue.   Nt sure the parameter should be added as part of the body in this case as part of the consumer.  I’d defer that to Sergey, but certainly the CxfProducer 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

Willem, IMHO this should be optional

Thanks, Sergey

> Dan
>
>
>
> On Sep 24, 2014, at 9:24 AM, Willem Jiang <[hidden email]> wrote:
>
>> Actually, this patch is try to avoid sending the message body with the DELETE method if camel proxy the request just like this
>>
>>   <from uri="cxfrs://bean://rsServer"/>
>>   <to uri="log:body?level=INFO"/>
>>   <to uri="cxfrs://bean://rsClient"/>
>>
>> As camel-cxfrs consumer put the invocation parameters into the camel message body, the proxy just add the message body 124 like this
>>
>> 2014-09-24 21:00:19,378 [qtp841166421-29] INFO  LoggingInInterceptor           - Inbound Message
>> ----------------------------
>> ID: 11
>> Address: http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/124/
>> Http-Method: DELETE
>> Content-Type:
>> Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Type=[null], Host=[localhost:1101], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)]}
>> --------------------------------------
>> 2014-09-24 21:00:19,380 [qtp841166421-29] INFO  body                           - Exchange[ExchangePattern: InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124]
>> 2014-09-24 21:00:19,385 [qtp841166421-29] INFO  LoggingOutInterceptor          - Outbound Message
>> ---------------------------
>> ID: 12
>> Address: http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124/
>> Http-Method: DELETE
>> Content-Type: application/xml
>> Headers: {Host=[localhost:1101], org.apache.cxf.request.method=[DELETE], accept-encoding=[gzip,deflate], connection=[keep-alive], org.apache.cxf.message.Message.PATH_INFO=[/customerservice/customers/124/], breadcrumbId=[ID-localhost-51196-1411563616702-4-3], Accept=[*/*], org.apache.cxf.request.uri=[/CxfRsRouterTest/route/customerservice/customers/124/], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)], Content-Type=[application/xml]}
>> Payload: 124
>>
>> If we remove the message body in the application level (in the camel route), the camel 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: 姜宁willem
>>
>>
>>
>> On September 24, 2014 at 7:49:26 PM, Daniel Kulp ([hidden email]) wrote:
>>>
>>> Willem,
>>>
>>> My reading of the discussion is that a DELETE MAY contain a message body, but the semantics
>>> are somewhat undefined. A proxy SHOULD forward that body on. This commit seems to make
>>> sure it doesn’t forward it along. Thus, I’m kind of against this commit.
>>>
>>> We also had a discussion about this on the CXF list a while ago where the body was needed:
>>>
>>> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html
>>>
>>>
>>>
>>> Dan
>>>
>>>
>>>
>>> On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:
>>>
>>>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using
>>> DELETE method
>>>>
>>>>
>>>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
>>>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61
>>>> 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
>>>>
>>>> ----------------------------------------------------------------------
>>>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--
>>>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +
>>>> 2 files changed, 3 insertions(+), 2 deletions(-)
>>>> ----------------------------------------------------------------------
>>>>
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>>>> ----------------------------------------------------------------------
>>>> diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>>> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>>>> index 572e991..c580445 100644
>>>> --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>>>> +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
>>>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
>>>>
>>>> // set the body
>>>> Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);
>>>> if (LOG.isTraceEnabled()) {
>>>> LOG.trace("Request body = " + body);
>>>>
>>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>>>> ----------------------------------------------------------------------
>>>> diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>>> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>>>> index 154b572..9f51dd6 100644
>>>> --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>>>> +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
>>>> @@ -64,6 +64,7 @@
>>>>
>>>>
>>>>
>>>> +
>>>>
>>>>
>>>> True
>>>>
>>>
>>> --
>>> Daniel Kulp
>>> [hidden email] - http://dankulp.com/blog
>>> Talend Community Coder - http://coders.talend.com
>

Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

Willem.Jiang
Administrator
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.

Any thoughts? 


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 24, 2014 at 9:47:58 PM, Sergey Beryozkin ([hidden email]) wrote:

> Hi Dan, Willem
> On 24/09/14 14:37, Daniel Kulp wrote:
> >
> > That’s likely a different issue. Nt sure the parameter should be added as part of the  
> body in this case as part of the consumer. I’d defer that to Sergey, but certainly the CxfProducer  
> 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
>  
> Willem, IMHO this should be optional
>  
> Thanks, Sergey
>  
> > Dan
> >
> >
> >
> > On Sep 24, 2014, at 9:24 AM, Willem Jiang wrote:
> >
> >> Actually, this patch is try to avoid sending the message body with the DELETE method  
> if camel proxy the request just like this
> >>
> >>  
> >>  
> >>  
> >>
> >> As camel-cxfrs consumer put the invocation parameters into the camel message body,  
> the proxy just add the message body 124 like this
> >>
> >> 2014-09-24 21:00:19,378 [qtp841166421-29] INFO LoggingInInterceptor - Inbound  
> Message
> >> ----------------------------
> >> ID: 11
> >> Address: http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/124/ 
> >> Http-Method: DELETE
> >> Content-Type:
> >> Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Type=[null],  
> Host=[localhost:1101], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)]}
> >> --------------------------------------
> >> 2014-09-24 21:00:19,380 [qtp841166421-29] INFO body - Exchange[ExchangePattern:  
> InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124]
> >> 2014-09-24 21:00:19,385 [qtp841166421-29] INFO LoggingOutInterceptor - Outbound  
> Message
> >> ---------------------------
> >> ID: 12
> >> Address: http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124/ 
> >> Http-Method: DELETE
> >> Content-Type: application/xml
> >> Headers: {Host=[localhost:1101], org.apache.cxf.request.method=[DELETE],  
> accept-encoding=[gzip,deflate], connection=[keep-alive], org.apache.cxf.message.Message.PATH_INFO=[/customerservice/customers/124/],  
> breadcrumbId=[ID-localhost-51196-1411563616702-4-3], Accept=[*/*], org.apache.cxf.request.uri=[/CxfRsRouterTest/route/customerservice/customers/124/],  
> User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)], Content-Type=[application/xml]}  
> >> Payload: 124
> >>
> >> If we remove the message body in the application level (in the camel route), the camel  
> 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: 姜宁willem
> >>
> >>
> >>
> >> On September 24, 2014 at 7:49:26 PM, Daniel Kulp ([hidden email]) wrote:
> >>>
> >>> Willem,
> >>>
> >>> My reading of the discussion is that a DELETE MAY contain a message body, but the semantics  
> >>> are somewhat undefined. A proxy SHOULD forward that body on. This commit seems to  
> make
> >>> sure it doesn’t forward it along. Thus, I’m kind of against this commit.
> >>>
> >>> We also had a discussion about this on the CXF list a while ago where the body was needed:  
> >>>
> >>> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html 
> >>>
> >>>
> >>>
> >>> Dan
> >>>
> >>>
> >>>
> >>> On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:
> >>>
> >>>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using  
> >>> DELETE method
> >>>>
> >>>>
> >>>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> >>>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61 
> >>>> 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
> >>>>
> >>>> ----------------------------------------------------------------------  
> >>>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--  
> >>>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +
> >>>> 2 files changed, 3 insertions(+), 2 deletions(-)
> >>>> ----------------------------------------------------------------------  
> >>>>
> >>>>
> >>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java 
> >>>> ----------------------------------------------------------------------  
> >>>> diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>>> index 572e991..c580445 100644
> >>>> --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>>> +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
> >>>>
> >>>> // set the body
> >>>> Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);  
> >>>> if (LOG.isTraceEnabled()) {
> >>>> LOG.trace("Request body = " + body);
> >>>>
> >>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml 
> >>>> ----------------------------------------------------------------------  
> >>>> diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>>> index 154b572..9f51dd6 100644
> >>>> --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>>> +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>>> @@ -64,6 +64,7 @@
> >>>>
> >>>>
> >>>>
> >>>> +
> >>>>
> >>>>
> >>>> True
> >>>>
> >>>
> >>> --
> >>> Daniel Kulp
> >>> [hidden email] - http://dankulp.com/blog
> >>> Talend Community Coder - http://coders.talend.com
> >
>  
>  

Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

Babak Vahdat
Hi Willem,

I guess the naming of the setter method is wrong (doesn’t adhere the Java bean style) which’s why we do currently fail to invoke it through our IntrospectionSupport utility when it’s given through an URI option:
https://github.com/apache/camel/commit/53792cc1cf4c45f3fae6d8cc84a3b15fb12cc05a#diff-154901a934ad9ebad992c3fa1e8bbcbaR409

This is exactly why this setter doesn’t get invoked at all although you set it as an URI option below
https://github.com/apache/camel/commit/53792cc1cf4c45f3fae6d8cc84a3b15fb12cc05a#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.

Any thoughts? 


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 24, 2014 at 9:47:58 PM, Sergey Beryozkin ([hidden email]) wrote:
> Hi Dan, Willem
> On 24/09/14 14:37, Daniel Kulp wrote:
> >
> > That’s likely a different issue. Nt sure the parameter should be added as part of the  
> body in this case as part of the consumer. I’d defer that to Sergey, but certainly the CxfProducer  
> 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
>  
> Willem, IMHO this should be optional
>  
> Thanks, Sergey
>  
> > Dan
> >
> >
> >
> > On Sep 24, 2014, at 9:24 AM, Willem Jiang wrote:
> >
> >> Actually, this patch is try to avoid sending the message body with the DELETE method  
> if camel proxy the request just like this
> >>
> >>  
> >>  
> >>  
> >>
> >> As camel-cxfrs consumer put the invocation parameters into the camel message body,  
> the proxy just add the message body 124 like this
> >>
> >> 2014-09-24 21:00:19,378 [qtp841166421-29] INFO LoggingInInterceptor - Inbound  
> Message
> >> ----------------------------
> >> ID: 11
> >> Address: http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/124/ 
> >> Http-Method: DELETE
> >> Content-Type:
> >> Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Type=[null],  
> Host=[localhost:1101], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)]}
> >> --------------------------------------
> >> 2014-09-24 21:00:19,380 [qtp841166421-29] INFO body - Exchange[ExchangePattern:  
> InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124]
> >> 2014-09-24 21:00:19,385 [qtp841166421-29] INFO LoggingOutInterceptor - Outbound  
> Message
> >> ---------------------------
> >> ID: 12
> >> Address: http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124/ 
> >> Http-Method: DELETE
> >> Content-Type: application/xml
> >> Headers: {Host=[localhost:1101], org.apache.cxf.request.method=[DELETE],  
> accept-encoding=[gzip,deflate], connection=[keep-alive], org.apache.cxf.message.Message.PATH_INFO=[/customerservice/customers/124/],  
> breadcrumbId=[ID-localhost-51196-1411563616702-4-3], Accept=[*/*], org.apache.cxf.request.uri=[/CxfRsRouterTest/route/customerservice/customers/124/],  
> User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)], Content-Type=[application/xml]}  
> >> Payload: 124
> >>
> >> If we remove the message body in the application level (in the camel route), the camel  
> 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: 姜宁willem
> >>
> >>
> >>
> >> On September 24, 2014 at 7:49:26 PM, Daniel Kulp ([hidden email]) wrote:
> >>>
> >>> Willem,
> >>>
> >>> My reading of the discussion is that a DELETE MAY contain a message body, but the semantics  
> >>> are somewhat undefined. A proxy SHOULD forward that body on. This commit seems to  
> make
> >>> sure it doesn’t forward it along. Thus, I’m kind of against this commit.
> >>>
> >>> We also had a discussion about this on the CXF list a while ago where the body was needed:  
> >>>
> >>> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html 
> >>>
> >>>
> >>>
> >>> Dan
> >>>
> >>>
> >>>
> >>> On Sep 24, 2014, at 1:44 AM, [hidden email] wrote:
> >>>
> >>>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using  
> >>> DELETE method
> >>>>
> >>>>
> >>>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> >>>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61 
> >>>> 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
> >>>>
> >>>> ----------------------------------------------------------------------  
> >>>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 4 ++--  
> >>>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +
> >>>> 2 files changed, 3 insertions(+), 2 deletions(-)
> >>>> ----------------------------------------------------------------------  
> >>>>
> >>>>
> >>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java 
> >>>> ----------------------------------------------------------------------  
> >>>> diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>>> index 572e991..c580445 100644
> >>>> --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>>> +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >>>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends DefaultProducer {
> >>>>
> >>>> // set the body
> >>>> Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage, exchange);  
> >>>> if (LOG.isTraceEnabled()) {
> >>>> LOG.trace("Request body = " + body);
> >>>>
> >>>> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml 
> >>>> ----------------------------------------------------------------------  
> >>>> diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>>> index 154b572..9f51dd6 100644
> >>>> --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>>> +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >>>> @@ -64,6 +64,7 @@
> >>>>
> >>>>
> >>>>
> >>>> +
> >>>>
> >>>>
> >>>> True
> >>>>
> >>>
> >>> --
> >>> Daniel Kulp
> >>> [hidden email] - http://dankulp.com/blog
> >>> Talend Community Coder - http://coders.talend.com
> >
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: [2/3] git commit: CAMEL-7856 camel-cxf producer HttpAPI should not send the message body when using DELETE method

Willem.Jiang
Administrator
Sorry, it’s my mistake. I will commit a quick fix for it shortly.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 28, 2014 at 5:51:50 AM, Babak Vahdat ([hidden email]) wrote:

> Hi Willem,
>  
> I guess the naming of the setter method is wrong (doesn’t adhere the Java
> bean style) which’s why we do currently fail to invoke it through our
> IntrospectionSupport utility when it’s given through an URI option:
> https://github.com/apache/camel/commit/53792cc1cf4c45f3fae6d8cc84a3b15fb12cc05a#diff-154901a934ad9ebad992c3fa1e8bbcbaR409 
>  
> This is exactly why this setter doesn’t get invoked at all although you set
> it as an URI option below
> https://github.com/apache/camel/commit/53792cc1cf4c45f3fae6d8cc84a3b15fb12cc05a#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.
> >
> > Any thoughts?
> >
> >
> > --
> > Willem Jiang
> >
> > Red Hat, Inc.
> > Web: http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (English)
> > http://jnn.iteye.com (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> >
> >
> > 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’s likely a different issue. Nt sure the parameter should be added
> >> as part of the
> >> body in this case as part of the consumer. I’d defer that to Sergey, but
> >> certainly the CxfProducer
> >> 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
> >>
> >> Willem, IMHO this should be optional
> >>
> >> Thanks, Sergey
> >>
> >> > Dan
> >> >
> >> >
> >> >
> >> > On Sep 24, 2014, at 9:24 AM, Willem Jiang wrote:
> >> >
> >> >> Actually, this patch is try to avoid sending the message body with the
> >> DELETE method
> >> if camel proxy the request just like this
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> As camel-cxfrs consumer put the invocation parameters into the camel
> >> message body,
> >> the proxy just add the message body 124 like this
> >> >>
> >> >> 2014-09-24 21:00:19,378 [qtp841166421-29] INFO LoggingInInterceptor -
> >> Inbound
> >> Message
> >> >> ----------------------------
> >> >> ID: 11
> >> >> Address:
> >> http://localhost:1101/CxfRsRouterTest/route/customerservice/customers/124/ 
> >> >> Http-Method: DELETE
> >> >> Content-Type:
> >> >> Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive],
> >> Content-Type=[null],
> >> Host=[localhost:1101], User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)]}
> >> >> --------------------------------------
> >> >> 2014-09-24 21:00:19,380 [qtp841166421-29] INFO body -
> >> Exchange[ExchangePattern:
> >> InOut, BodyType: org.apache.cxf.message.MessageContentsList, Body: 124]
> >> >> 2014-09-24 21:00:19,385 [qtp841166421-29] INFO LoggingOutInterceptor -
> >> Outbound
> >> Message
> >> >> ---------------------------
> >> >> ID: 12
> >> >> Address:
> >> http://localhost:1102/CxfRsRouterTest/rest/customerservice/customers/124/ 
> >> >> Http-Method: DELETE
> >> >> Content-Type: application/xml
> >> >> Headers: {Host=[localhost:1101],
> >> org.apache.cxf.request.method=[DELETE],
> >> accept-encoding=[gzip,deflate], connection=[keep-alive],
> >> org.apache.cxf.message.Message.PATH_INFO=[/customerservice/customers/124/],  
> >> breadcrumbId=[ID-localhost-51196-1411563616702-4-3], Accept=[*/*],
> >> org.apache.cxf.request.uri=[/CxfRsRouterTest/route/customerservice/customers/124/],  
> >> User-Agent=[Apache-HttpClient/4.3.3 (java 1.5)],
> >> Content-Type=[application/xml]}
> >> >> Payload: 124
> >> >>
> >> >> If we remove the message body in the application level (in the camel
> >> route), the camel
> >> 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: 姜宁willem
> >> >>
> >> >>
> >> >>
> >> >> 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
> >> >>> are somewhat undefined. A proxy SHOULD forward that body on. This
> >> commit seems to
> >> make
> >> >>> sure it doesn’t forward it along. Thus, I’m kind of against this
> >> commit.
> >> >>>
> >> >>> We also had a discussion about this on the CXF list a while ago where
> >> the body was needed:
> >> >>>
> >> >>>
> >> http://cxf.547215.n5.nabble.com/Sending-body-in-DELETE-HTTP-Requests-with-JAXRSClientFactoryBean-tt5735129.html 
> >> >>>
> >> >>>
> >> >>>
> >> >>> Dan
> >> >>>
> >> >>>
> >> >>>
> >> >>> On Sep 24, 2014, at 1:44 AM,
>  
> > ningjiang@
>  
> > wrote:
> >> >>>
> >> >>>> CAMEL-7856 camel-cxf producer HttpAPI should not send the message
> >> body when using
> >> >>> DELETE method
> >> >>>>
> >> >>>>
> >> >>>> Project: http://git-wip-us.apache.org/repos/asf/camel/repo
> >> >>>> Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5b4abb61 
> >> >>>> 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
> >> >>>>
> >> >>>>
> >> ----------------------------------------------------------------------  
> >> >>>> .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java |  
> 4
> >> ++--
> >> >>>> .../org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml | 1 +  
> >> >>>> 2 files changed, 3 insertions(+), 2 deletions(-)
> >> >>>>
> >> ----------------------------------------------------------------------  
> >> >>>>
> >> >>>>
> >> >>>>
> >> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java 
> >> >>>>
> >> ----------------------------------------------------------------------  
> >> >>>> diff --git
> >> a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >> >>>
> >> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >> >>>> index 572e991..c580445 100644
> >> >>>> ---
> >> a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >> >>>> +++
> >> b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java  
> >> >>>> @@ -158,8 +158,8 @@ public class CxfRsProducer extends
> >> DefaultProducer {
> >> >>>>
> >> >>>> // set the body
> >> >>>> Object body = 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 = binding.bindCamelMessageBodyToRequestBody(inMessage,
> >> exchange);
> >> >>>> if (LOG.isTraceEnabled()) {
> >> >>>> LOG.trace("Request body = " + body);
> >> >>>>
> >> >>>>
> >> http://git-wip-us.apache.org/repos/asf/camel/blob/5b4abb61/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml 
> >> >>>>
> >> ----------------------------------------------------------------------  
> >> >>>> diff --git
> >> a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >> >>>
> >> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >> >>>> index 154b572..9f51dd6 100644
> >> >>>> ---
> >> a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >> >>>> +++
> >> b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml  
> >> >>>> @@ -64,6 +64,7 @@
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> +
> >> >>>>
> >> >>>>
> >> >>>> True
> >> >>>>
> >> >>>
> >> >>> --
> >> >>> Daniel Kulp
> >> >>>
>  
> > dkulp@
>  
> > - http://dankulp.com/blog
> >> >>> Talend Community Coder - http://coders.talend.com
> >> >
> >>
> >>
>  
>  
>  
>  
>  
> --
> 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-body-when-using-d-tp5756960p5757113.html 
> Sent from the Camel Development mailing list archive at Nabble.com.
>  

Reply | Threaded
Open this post in threaded view
|

Few CXFRS patches

Sergey Beryozkin
Hi All,

Happy New Year,

I've worked on creating few CXFRS patches, Willem has helped with
applying one of them (thanks).

I'd like to ask Willem or someone else who has some experience with
CXFRS to review and apply two more patches (sometime next week would be
great).

The patch at [1] fixes a minor bug where CXFRS does not support CXF
JAX-RS model resources. I'm aware a number of CXF users do use the
external models to turn non-annotated classes into JAX-RS endpoints, so
it is going be useful. Besides, I'd like to use this fix as a base for
doing an initial POC for CXFRS endpoint registering a model only, no
concrete interfaces or implementations (though I guess some default
class would have to be used internally).

The patch at [2] provides for an optional but very important improvement
which will make it much easier for CXF JAX-RS users with the existing
JAX-RS implementations migrate to Camel. It is safe, simple and as I
said, optional. As I explained at [3], this patch will let CXFRS users
route not only the request properties to the next route point but also
an existing service's response if it is possible. Example, the existing
DB query would return some object (thus no need to do it again in a
Camel processor) and then the processor would posty the response to a
queue, log, etc...

Patch to [4] is also available, but I'm thinking it may need a bit more
work, so patches to [1] and [2] is what I'd appreciate someone aplying
next week

Cheers, Sergey


[1] https://issues.apache.org/jira/browse/CAMEL-8245
[2] https://issues.apache.org/jira/browse/CAMEL-8205
[3]
https://issues.apache.org/jira/browse/CAMEL-8205?focusedCommentId=14277177&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14277177
[4] https://issues.apache.org/jira/browse/CAMEL-8238

Reply | Threaded
Open this post in threaded view
|

Re: Few CXFRS patches

Claus Ibsen-2
On Fri, Jan 16, 2015 at 6:13 PM, Sergey Beryozkin <[hidden email]> wrote:

> Hi All,
>
> Happy New Year,
>
> I've worked on creating few CXFRS patches, Willem has helped with applying
> one of them (thanks).
>
> I'd like to ask Willem or someone else who has some experience with CXFRS to
> review and apply two more patches (sometime next week would be great).
>
> The patch at [1] fixes a minor bug where CXFRS does not support CXF JAX-RS
> model resources. I'm aware a number of CXF users do use the external models
> to turn non-annotated classes into JAX-RS endpoints, so it is going be
> useful. Besides, I'd like to use this fix as a base for doing an initial POC
> for CXFRS endpoint registering a model only, no concrete interfaces or
> implementations (though I guess some default class would have to be used
> internally).
>

Would that also be possible to build a model in CXF for CXF-RS
services? I am asking as the new rest-dsl does that. And we support a
number of components, but not yet CXF.

So if that is possible or almost possible in CXF, then IMHO it would
be good if we could get it possible, so camel-cxf is supported with
rest-dsl.

There is a JIRA ticket
https://issues.apache.org/jira/browse/CAMEL-7652



> The patch at [2] provides for an optional but very important improvement
> which will make it much easier for CXF JAX-RS users with the existing JAX-RS
> implementations migrate to Camel. It is safe, simple and as I said,
> optional. As I explained at [3], this patch will let CXFRS users route not
> only the request properties to the next route point but also an existing
> service's response if it is possible. Example, the existing DB query would
> return some object (thus no need to do it again in a Camel processor) and
> then the processor would posty the response to a queue, log, etc...
>
> Patch to [4] is also available, but I'm thinking it may need a bit more
> work, so patches to [1] and [2] is what I'd appreciate someone aplying next
> week
>
> Cheers, Sergey
>
>
> [1] https://issues.apache.org/jira/browse/CAMEL-8245
> [2] https://issues.apache.org/jira/browse/CAMEL-8205
> [3]
> https://issues.apache.org/jira/browse/CAMEL-8205?focusedCommentId=14277177&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14277177
> [4] https://issues.apache.org/jira/browse/CAMEL-8238
>



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Reply | Threaded
Open this post in threaded view
|

Re: Few CXFRS patches

Willem.Jiang
Administrator
In reply to this post by Sergey Beryozkin
Hi Sergey,

I will take care of those patches this weekend.

Regards,

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 17, 2015 at 1:14:12 AM, Sergey Beryozkin ([hidden email]) wrote:

> Hi All,
>  
> Happy New Year,
>  
> I've worked on creating few CXFRS patches, Willem has helped with
> applying one of them (thanks).
>  
> I'd like to ask Willem or someone else who has some experience with
> CXFRS to review and apply two more patches (sometime next week would be
> great).
>  
> The patch at [1] fixes a minor bug where CXFRS does not support CXF
> JAX-RS model resources. I'm aware a number of CXF users do use the
> external models to turn non-annotated classes into JAX-RS endpoints, so
> it is going be useful. Besides, I'd like to use this fix as a base for
> doing an initial POC for CXFRS endpoint registering a model only, no
> concrete interfaces or implementations (though I guess some default
> class would have to be used internally).
>  
> The patch at [2] provides for an optional but very important improvement
> which will make it much easier for CXF JAX-RS users with the existing
> JAX-RS implementations migrate to Camel. It is safe, simple and as I
> said, optional. As I explained at [3], this patch will let CXFRS users
> route not only the request properties to the next route point but also
> an existing service's response if it is possible. Example, the existing
> DB query would return some object (thus no need to do it again in a
> Camel processor) and then the processor would posty the response to a
> queue, log, etc...
>  
> Patch to [4] is also available, but I'm thinking it may need a bit more
> work, so patches to [1] and [2] is what I'd appreciate someone aplying
> next week
>  
> Cheers, Sergey
>  
>  
> [1] https://issues.apache.org/jira/browse/CAMEL-8245
> [2] https://issues.apache.org/jira/browse/CAMEL-8205
> [3]
> https://issues.apache.org/jira/browse/CAMEL-8205?focusedCommentId=14277177&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14277177 
> [4] https://issues.apache.org/jira/browse/CAMEL-8238
>  
>  

Reply | Threaded
Open this post in threaded view
|

Re: Few CXFRS patches

Sergey Beryozkin
Hi Willem

Thanks for spending your spare time on applying these patches.
Cheers, Sergey
On 17/01/15 12:13, Willem Jiang wrote:

> Hi Sergey,
>
> I will take care of those patches this weekend.
>
> Regards,
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On January 17, 2015 at 1:14:12 AM, Sergey Beryozkin ([hidden email]) wrote:
>> Hi All,
>>
>> Happy New Year,
>>
>> I've worked on creating few CXFRS patches, Willem has helped with
>> applying one of them (thanks).
>>
>> I'd like to ask Willem or someone else who has some experience with
>> CXFRS to review and apply two more patches (sometime next week would be
>> great).
>>
>> The patch at [1] fixes a minor bug where CXFRS does not support CXF
>> JAX-RS model resources. I'm aware a number of CXF users do use the
>> external models to turn non-annotated classes into JAX-RS endpoints, so
>> it is going be useful. Besides, I'd like to use this fix as a base for
>> doing an initial POC for CXFRS endpoint registering a model only, no
>> concrete interfaces or implementations (though I guess some default
>> class would have to be used internally).
>>
>> The patch at [2] provides for an optional but very important improvement
>> which will make it much easier for CXF JAX-RS users with the existing
>> JAX-RS implementations migrate to Camel. It is safe, simple and as I
>> said, optional. As I explained at [3], this patch will let CXFRS users
>> route not only the request properties to the next route point but also
>> an existing service's response if it is possible. Example, the existing
>> DB query would return some object (thus no need to do it again in a
>> Camel processor) and then the processor would posty the response to a
>> queue, log, etc...
>>
>> Patch to [4] is also available, but I'm thinking it may need a bit more
>> work, so patches to [1] and [2] is what I'd appreciate someone aplying
>> next week
>>
>> Cheers, Sergey
>>
>>
>> [1] https://issues.apache.org/jira/browse/CAMEL-8245
>> [2] https://issues.apache.org/jira/browse/CAMEL-8205
>> [3]
>> https://issues.apache.org/jira/browse/CAMEL-8205?focusedCommentId=14277177&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14277177
>> [4] https://issues.apache.org/jira/browse/CAMEL-8238
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Few CXFRS patches

Sergey Beryozkin
In reply to this post by Claus Ibsen-2
On 17/01/15 10:36, Claus Ibsen wrote:

> On Fri, Jan 16, 2015 at 6:13 PM, Sergey Beryozkin <[hidden email]> wrote:
>> Hi All,
>>
>> Happy New Year,
>>
>> I've worked on creating few CXFRS patches, Willem has helped with applying
>> one of them (thanks).
>>
>> I'd like to ask Willem or someone else who has some experience with CXFRS to
>> review and apply two more patches (sometime next week would be great).
>>
>> The patch at [1] fixes a minor bug where CXFRS does not support CXF JAX-RS
>> model resources. I'm aware a number of CXF users do use the external models
>> to turn non-annotated classes into JAX-RS endpoints, so it is going be
>> useful. Besides, I'd like to use this fix as a base for doing an initial POC
>> for CXFRS endpoint registering a model only, no concrete interfaces or
>> implementations (though I guess some default class would have to be used
>> internally).
>>
>
> Would that also be possible to build a model in CXF for CXF-RS
> services? I am asking as the new rest-dsl does that. And we support a
> number of components, but not yet CXF.
>
> So if that is possible or almost possible in CXF, then IMHO it would
> be good if we could get it possible, so camel-cxf is supported with
> rest-dsl.
>
> There is a JIRA ticket
> https://issues.apache.org/jira/browse/CAMEL-7652
To be honest I'm not exactly sure why it can be interesting. As far as I
understand users chose their favorite Camel HTTP-aware components and
work with them, why combine REST DSL Component and CXFRS ? The latter
has a no less capable native support for templates/etc.

from(cxfrs).to(cxfrs) works ok.

I guess from(restdsl).to(cxfrs) can be interesting from the pure
integration point of view.

I will investigate how this can be made to work once I make some more
progress on the CXF end with respect to loosening a bit the JAX-RS
frontend's strict reliance on having a concrete interface with JAX-RS
annotations being available...

Sergey

>
>
>
>> The patch at [2] provides for an optional but very important improvement
>> which will make it much easier for CXF JAX-RS users with the existing JAX-RS
>> implementations migrate to Camel. It is safe, simple and as I said,
>> optional. As I explained at [3], this patch will let CXFRS users route not
>> only the request properties to the next route point but also an existing
>> service's response if it is possible. Example, the existing DB query would
>> return some object (thus no need to do it again in a Camel processor) and
>> then the processor would posty the response to a queue, log, etc...
>>
>> Patch to [4] is also available, but I'm thinking it may need a bit more
>> work, so patches to [1] and [2] is what I'd appreciate someone aplying next
>> week
>>
>> Cheers, Sergey
>>
>>
>> [1] https://issues.apache.org/jira/browse/CAMEL-8245
>> [2] https://issues.apache.org/jira/browse/CAMEL-8205
>> [3]
>> https://issues.apache.org/jira/browse/CAMEL-8205?focusedCommentId=14277177&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14277177
>> [4] https://issues.apache.org/jira/browse/CAMEL-8238
>>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Camel Wiki edit rights

Sergey Beryozkin
In reply to this post by Sergey Beryozkin
Hi

I'd like to edit the CXFRS wiki page, can the edit rights be set for a
'sergey_beryozkin' Wiki alias please ?

I've already signed CLA, this can be validated by checking
iclas.txt.

Thanks, Sergey
Reply | Threaded
Open this post in threaded view
|

Re: Camel Wiki edit rights

Claus Ibsen-2
Hi

I have granted you karma.

On Mon, Mar 2, 2015 at 12:06 PM, Sergey Beryozkin <[hidden email]> wrote:
> Hi
>
> I'd like to edit the CXFRS wiki page, can the edit rights be set for a
> 'sergey_beryozkin' Wiki alias please ?
>
> I've already signed CLA, this can be validated by checking
> iclas.txt.
>
> Thanks, Sergey



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Reply | Threaded
Open this post in threaded view
|

Re: Camel Wiki edit rights

Sergey Beryozkin
Hi
On 02/03/15 12:00, Claus Ibsen wrote:
> Hi
>
> I have granted you karma.
>
Cool, thanks
Sergey

> On Mon, Mar 2, 2015 at 12:06 PM, Sergey Beryozkin <[hidden email]> wrote:
>> Hi
>>
>> I'd like to edit the CXFRS wiki page, can the edit rights be set for a
>> 'sergey_beryozkin' Wiki alias please ?
>>
>> I've already signed CLA, this can be validated by checking
>> iclas.txt.
>>
>> Thanks, Sergey
>
>
>

Reply | Threaded
Open this post in threaded view
|

Camel Transport and CXF : where to convert response Date headers

Sergey Beryozkin
In reply to this post by Sergey Beryozkin
Hi All

In CXF the response headers which have java.util.Date values converted
at the HTTP transport level into HTTP-friendly representations.
When CXF (JAX-RS) endpoints are integrated into Camel routes using Camel
Transport, example:

    <jaxrs:server id="hello_rest"
address="camel://direct:HelloWorldRestServerEndpoint">
         <!-- -->
     </jaxrs:server>

   <camelContext>
         <route>
             <from uri="servlet:///HelloWorld?matchOnUriPrefix=true"/>
             <to uri="direct:HelloWorldRestServerEndpoint"/>
         </route>
  </camelContext>


the response Date headers, if available, get converted to String by the
global Camel type converter at the DefaultHttpBinding (camel http
common) level.

I opened with a patch attached. The idea there is that Date headers
coming out of CXF get converted to HTTP format Strings at the Camel
to/from CXF integration level.

I think there might be a bit of sensitivity associated with such a fix,
as one can imagine a non-HTTP consumer that links to CXF via Camel
Transport. I.e, the question is what if, when a CXF response header
contains a Date instance, the default Date.toString() is desired ?

I think it is somewhat unlikely however, assuming the patch [1] gets
accepted, the following options are available to CXF services which are
linked to with Camel Transport:
- do Date.toString() at the CXF level - the simplest option
- the patch [1] introduces a Camel exchange property that would let Date
headers propagated unchanged back to Camel

I think this is reasonable and covers all the variations.
However if someone thinks this is not perfect then the alternative is to
drop [1] but re-implement a similar solution at DefaultHttpBinding level:
- if it is a response header with a Date value then convert it inside
DefaultHttpBinding to the HTTP friendly format - it is difficult to
imagine why a non-HTTP format would be required at the point of
returning Dates to the external HTTP clients.
- Add the option to let users delegate Date to String conversions to
Camel to the type converters if really needed

To summarize I think a patch at [1] offers a flexible solution for users
doing a Camel CXF integration with Camel transport.
If it is not accepted then I can do a patch against DefaultHttpBinding
as suggested above - perhaps that can be useful to non-CXF users too

Let me know please
Sergey






[1] https://issues.apache.org/jira/browse/CAMEL-9091


Reply | Threaded
Open this post in threaded view
|

Re: Camel Transport and CXF : where to convert response Date headers

Sergey Beryozkin

> I opened with a patch attached. The idea there is that Date headers
> coming out of CXF get converted to HTTP format Strings at the Camel
> to/from CXF integration level.
The link to [1] https://issues.apache.org/jira/browse/CAMEL-9091
was left out...

>
> I think there might be a bit of sensitivity associated with such a fix,
> as one can imagine a non-HTTP consumer that links to CXF via Camel
> Transport. I.e, the question is what if, when a CXF response header
> contains a Date instance, the default Date.toString() is desired ?
>
> I think it is somewhat unlikely however, assuming the patch [1] gets
> accepted, the following options are available to CXF services which are
> linked to with Camel Transport:
> - do Date.toString() at the CXF level - the simplest option
> - the patch [1] introduces a Camel exchange property that would let Date
> headers propagated unchanged back to Camel
>
> I think this is reasonable and covers all the variations.
> However if someone thinks this is not perfect then the alternative is to
> drop [1] but re-implement a similar solution at DefaultHttpBinding level:
> - if it is a response header with a Date value then convert it inside
> DefaultHttpBinding to the HTTP friendly format - it is difficult to
> imagine why a non-HTTP format would be required at the point of
> returning Dates to the external HTTP clients.
> - Add the option to let users delegate Date to String conversions to
> Camel to the type converters if really needed
>
> To summarize I think a patch at [1] offers a flexible solution for users
> doing a Camel CXF integration with Camel transport.
> If it is not accepted then I can do a patch against DefaultHttpBinding
> as suggested above - perhaps that can be useful to non-CXF users too
>
> Let me know please
> Sergey
>
>
>
>
>
>
> [1] https://issues.apache.org/jira/browse/CAMEL-9091
>
>


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/
Reply | Threaded
Open this post in threaded view
|

Re: Camel Transport and CXF : where to convert response Date headers

Sergey Beryozkin
I've created
https://issues.apache.org/jira/browse/CAMEL-9105.
Thinking more about it, DefaultHttpDestination is the best place to get Date (and Locale) conversions handled, as noted though the existing code where global TypeConverters are used would still work.

I'll create a patch next week and then hopefully it will be accepted and CAMEL-9091 will be invalidated.

Sergey
Reply | Threaded
Open this post in threaded view
|

Re: Camel Transport and CXF : where to convert response Date headers

Sergey Beryozkin
Sorry can someone please add a new component to JIRA, camel-http-common ? I had to list camel-http in CAMEL-9105

Thanks
12