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, ningji...@apache.org 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 <willem.ji...@gmail.com>
Authored: Wed Sep 24 13:41:41 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
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 via email to