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/remotes/origin/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>