You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2021/03/02 19:19:11 UTC

[camel] branch camel-2.25.x updated: [CAMEL-16291]camel-cxfrs producer shouldn't try to read Entity from javax.ws.rs.core.Response

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch camel-2.25.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.25.x by this push:
     new f1baabe  [CAMEL-16291]camel-cxfrs producer shouldn't try to read Entity from javax.ws.rs.core.Response
f1baabe is described below

commit f1baabea26ddb8fe84eb8ebef8d924da7636bd6f
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Mar 2 14:12:31 2021 -0500

    [CAMEL-16291]camel-cxfrs producer shouldn't try to read Entity from javax.ws.rs.core.Response
    
    (cherry picked from commit 8610f301abdfc12fc0ee395ef7ee59f56d691827)
    (cherry picked from commit b404b58fdab82fc9cecf7de5594ed81ba924cad7)
---
 .../java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 7df2119..9ba1469 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
@@ -178,7 +178,14 @@ public class CxfRsProducer extends DefaultProducer implements AsyncProcessor {
         loadCookies(exchange, client, cookieHandler);
         
         // invoke the client
-        client.async().method(httpMethod, entity, new CxfInvocationCallback(client, exchange, cxfRsEndpoint, responseClass, callback, genericType));
+        if (responseClass == null || Response.class.equals(responseClass)) {
+            client.async().method(httpMethod, entity,
+                    new CxfInvocationCallback(client, exchange, cxfRsEndpoint, null, callback, null));
+        } else {
+            client.async().method(httpMethod, entity,
+                    new CxfInvocationCallback(client, exchange, cxfRsEndpoint, responseClass, callback, genericType));
+        }
+
     }
 
     protected void invokeAsyncProxyClient(Exchange exchange, final AsyncCallback callback) throws Exception {