Author: ningjiang Date: Wed Dec 28 08:33:33 2011 New Revision: 1225143 URL: http://svn.apache.org/viewvc?rev=1225143&view=rev Log: Merged revisions 1225078 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
........ r1225078 | ningjiang | 2011-12-28 11:06:36 +0800 (Wed, 28 Dec 2011) | 1 line CAMEL-4835 camel-cxfrs should support to look up the CXF message from the camel message header ........ Modified: camel/branches/camel-2.8.x/ (props changed) camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java Propchange: camel/branches/camel-2.8.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Dec 28 08:33:33 2011 @@ -1 +1 @@ -/camel/trunk:1212504,1215477,1221565,1224674,1225077 +/camel/trunk:1212504,1215477,1221565,1224674,1225077-1225078 Propchange: camel/branches/camel-2.8.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java?rev=1225143&r1=1225142&r2=1225143&view=diff ============================================================================== --- camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java (original) +++ camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java Wed Dec 28 08:33:33 2011 @@ -120,6 +120,8 @@ public class DefaultCxfRsBinding impleme camelMessage.setHeader(CxfConstants.OPERATION_NAME, method.getName()); + camelMessage.setHeader(CxfConstants.CAMEL_CXF_MESSAGE, cxfMessage); + camelMessage.setBody(new MessageContentsList(paramArray)); } Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java?rev=1225143&r1=1225142&r2=1225143&view=diff ============================================================================== --- camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java (original) +++ camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java Wed Dec 28 08:33:33 2011 @@ -20,6 +20,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; +import javax.servlet.ServletRequest; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; @@ -70,6 +71,15 @@ public class CxfRsConsumerTest extends C // We just put the response Object into the out message body exchange.getOut().setBody(customer); } else { + if ("/customerservice/customers/400".equals(path)) { + // We return the remote client IP address this time + org.apache.cxf.message.Message cxfMessage = inMessage.getHeader(CxfConstants.CAMEL_CXF_MESSAGE, org.apache.cxf.message.Message.class); + ServletRequest request = (ServletRequest) cxfMessage.get("HTTP.REQUEST"); + String remoteAddress = request.getRemoteAddr(); + Response r = Response.status(200).entity("The remoteAddress is " + remoteAddress).build(); + exchange.getOut().setBody(r); + return; + } if ("/customerservice/customers/123".equals(path)) { // send a customer response back Response r = Response.status(200).entity("customer response back!").build(); @@ -125,6 +135,8 @@ public class CxfRsConsumerTest extends C "{\"Customer\":{\"id\":126,\"name\":\"Willem\"}}"); invokeGetCustomer("http://localhost:9000/rest/customerservice/customers/123", "customer response back!"); + invokeGetCustomer("http://localhost:9000/rest/customerservice/customers/400", + "The remoteAddress is 127.0.0.1"); }