camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r906331 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
Date Thu, 04 Feb 2010 03:09:14 GMT
Author: ningjiang
Date: Thu Feb  4 03:09:14 2010
New Revision: 906331

URL: http://svn.apache.org/viewvc?rev=906331&view=rev
Log:
CAMEL-2447 cxfbean should propagate CONTENT_TYPE for other camel component to use

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java?rev=906331&r1=906330&r2=906331&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/DefaultCxfBeanBinding.java
Thu Feb  4 03:09:14 2010
@@ -123,6 +123,11 @@
             } 
         }
         
+        // propagate HTTP CONTENT_TYPE
+       if (cxfMessage.get(Message.CONTENT_TYPE) != null) {
+           camelHeaders.put(Exchange.CONTENT_TYPE, cxfMessage.get(Message.CONTENT_TYPE));
+       }
+        
     }
 
     protected String getPath(org.apache.camel.Message camelMessage) {

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java?rev=906331&r1=906330&r2=906331&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
Thu Feb  4 03:09:14 2010
@@ -35,6 +35,8 @@
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -59,7 +61,7 @@
         in = url.openStream();
         assertEquals("{\"Product\":{\"description\":\"product 323\",\"id\":323}}", CxfUtils.getStringFromInputStream(in));
         // END SNIPPET: clientInvocation
-
+        
     }
 
     @Test
@@ -72,6 +74,8 @@
         try {
             assertEquals(200, httpclient.executeMethod(put));
             assertEquals("", put.getResponseBodyAsString());
+         // need to check the content type
+            assertEquals("We should get content-type from the response", "text/xml", put.getResponseHeader("content-type").getValue());
         } finally {
             put.releaseConnection();
         }
@@ -89,6 +93,8 @@
             assertEquals(200, httpclient.executeMethod(post));
             assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
                     post.getResponseBodyAsString());
+            // need to check the content type
+            assertEquals("We should get content-type from the response", "text/xml", post.getResponseHeader("content-type").getValue());
         } finally {
             post.releaseConnection();
         }
@@ -107,6 +113,8 @@
             assertEquals(201, httpclient.executeMethod(post));
             assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Customer><id>125</id><name>Jack</name></Customer>",
                     post.getResponseBodyAsString());
+         // need to check the content type
+            assertEquals("We should get content-type from the response", "text/xml", post.getResponseHeader("content-type").getValue());
         } finally {
             post.releaseConnection();
         }
@@ -133,6 +141,9 @@
                 + "<personId>hello</personId><ssn>000-000-0000</ssn><name>Bonjour</name></GetPersonResponse></soap:Body></soap:Envelope>";
             
             assertEquals("Get a wrong response", correct, response);
+            System.out.println(post.getResponseHeader("content-type"));
+            // need to check the content type
+            assertEquals("We should get content-type from the response", "text/xml", post.getResponseHeader("content-type").getValue());
         } finally {
             post.releaseConnection();
         }



Mime
View raw message