camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1302761 - in /camel/branches/camel-2.9.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/ components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/ components/camel-solr/
Date Tue, 20 Mar 2012 02:41:47 GMT
Author: ningjiang
Date: Tue Mar 20 02:41:47 2012
New Revision: 1302761

URL: http://svn.apache.org/viewvc?rev=1302761&view=rev
Log:
Merged revisions 1302484 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1302484 | ningjiang | 2012-03-19 22:52:17 +0800 (Mon, 19 Mar 2012) | 1 line
  
  CAMEL-5107 cxfrs producer should retain the message headers when it gets the reponse
........

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
    camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
    camel/branches/camel-2.9.x/components/camel-solr/   (props changed)

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1302484

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java?rev=1302761&r1=1302760&r2=1302761&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
Tue Mar 20 02:41:47 2012
@@ -181,8 +181,9 @@ public class CxfRsProducer extends Defau
         // set response
         if (exchange.getPattern().isOutCapable()) {
             LOG.trace("Response body = {}", response);
+            exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
             exchange.getOut().setBody(binding.bindResponseToCamelBody(response, exchange));
-            exchange.getOut().setHeaders(binding.bindResponseHeadersToCamelHeaders(response,
exchange));
+            exchange.getOut().getHeaders().putAll(binding.bindResponseHeadersToCamelHeaders(response,
exchange));
             exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, statesCode);
         }
     }
@@ -230,8 +231,9 @@ public class CxfRsProducer extends Defau
         
         if (exchange.getPattern().isOutCapable()) {
             LOG.trace("Response body = {}", response);
+            exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
             exchange.getOut().setBody(binding.bindResponseToCamelBody(response, exchange));
-            exchange.getOut().setHeaders(binding.bindResponseHeadersToCamelHeaders(response,
exchange));
+            exchange.getOut().getHeaders().putAll(binding.bindResponseHeadersToCamelHeaders(response,
exchange));
             exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, statesCode);
         }
     }

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java?rev=1302761&r1=1302760&r2=1302761&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
Tue Mar 20 02:41:47 2012
@@ -80,6 +80,8 @@ public class CxfRsProducerTest extends C
                 inMessage.setHeader(CxfConstants.OPERATION_NAME, "getCustomer");
                 // using the proxy client API
                 inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, Boolean.FALSE);
+                // set a customer header
+                inMessage.setHeader("key", "value");
                 // set the parameters , if you just have one parameter 
                 // camel will put this object into an Object[] itself
                 inMessage.setBody("123");
@@ -93,6 +95,8 @@ public class CxfRsProducerTest extends C
         assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
         assertEquals("Get a wrong customer name", response.getName(), "John");
         assertEquals("Get a wrong response code", 200, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+        System.out.println(exchange.getOut().getHeaders());
+        assertEquals("Get a wrong header value", "value", exchange.getOut().getHeader("key"));
         // END SNIPPET: ProxyExample     
     }
     
@@ -138,6 +142,8 @@ public class CxfRsProducerTest extends C
                 inMessage.setHeader(Exchange.HTTP_PATH, "/customerservice/customers/123");
               
                 // Specify the response class , cxfrs will use InputStream as the response
object type 
                 inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Customer.class);
+                // set a customer header
+                inMessage.setHeader("key", "value");
                 // since we use the Get method, so we don't need to set the message body
                 inMessage.setBody(null);                
             }
@@ -150,6 +156,7 @@ public class CxfRsProducerTest extends C
         assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
         assertEquals("Get a wrong customer name", response.getName(), "John");
         assertEquals("Get a wrong response code", 200, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+        assertEquals("Get a wrong header value", "value", exchange.getOut().getHeader("key"));
         // END SNIPPET: HttpExample 
     }
     

Propchange: camel/branches/camel-2.9.x/components/camel-solr/
------------------------------------------------------------------------------
  Merged /camel/trunk/components/camel-solr:r1302484



Mime
View raw message