camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ond...@apache.org
Subject camel git commit: CAMEL-11892 - breadcrumbId class cast failure if other than SAAJ used as WebServiceMessage impl
Date Thu, 12 Oct 2017 15:06:32 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.20.x 0be79c6ed -> cf32b912e


CAMEL-11892 - breadcrumbId class cast failure if other than SAAJ used as WebServiceMessage
impl


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cf32b912
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cf32b912
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cf32b912

Branch: refs/heads/camel-2.20.x
Commit: cf32b912e153f389258f8293d0e0761ec131ad00
Parents: 0be79c6
Author: onders86 <ondersezgin+github@gmail.com>
Authored: Thu Oct 12 10:19:33 2017 +0300
Committer: onders86 <ondersezgin+github@gmail.com>
Committed: Thu Oct 12 18:05:56 2017 +0300

----------------------------------------------------------------------
 components/camel-spring-ws/pom.xml              |  6 ++++++
 .../spring/ws/SpringWebserviceConsumer.java     | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cf32b912/components/camel-spring-ws/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/pom.xml b/components/camel-spring-ws/pom.xml
index e50497e..35d69f5 100644
--- a/components/camel-spring-ws/pom.xml
+++ b/components/camel-spring-ws/pom.xml
@@ -51,6 +51,12 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-spring</artifactId>
     </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
+      <version>${javax.servlet-api-version}</version>
+      <scope>provided</scope>
+    </dependency>
 
     <!-- spring -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/cf32b912/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
index 5c9b72f..f2ba406 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConsumer.java
@@ -18,6 +18,8 @@ package org.apache.camel.component.spring.ws;
 
 import java.util.Iterator;
 import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
 import javax.xml.namespace.QName;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPMessage;
@@ -82,7 +84,15 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements
Message
     }
     
     private void populateExchangeWithBreadcrumbFromMessageContext(MessageContext messageContext,
Exchange exchange) {
-        SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest();
+        if (messageContext.getRequest() instanceof SaajSoapMessage) {
+            SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest();
+            populateExchangeWithBreadcrumbFromSaajMessage(exchange, saajSoap);
+        } else {
+            populateExchangeWithBreadcrumbFromMessageContext(exchange, messageContext);
+        }
+    }
+
+    private void populateExchangeWithBreadcrumbFromSaajMessage(Exchange exchange, SaajSoapMessage
saajSoap) {
         SOAPMessage soapMessageRequest = null;
         if (saajSoap != null) {
             soapMessageRequest = saajSoap.getSaajMessage();
@@ -102,6 +112,14 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements
Message
         }
     }
 
+    private void populateExchangeWithBreadcrumbFromMessageContext(Exchange exchange, MessageContext
messageContext) {
+        if (messageContext != null) {
+            HttpServletRequest obj = (HttpServletRequest) messageContext.getProperty("transport.http.servletRequest");
+            String breadcrumbId = (String) obj.getHeader(Exchange.BREADCRUMB_ID);
+            exchange.getIn().setHeader(Exchange.BREADCRUMB_ID, breadcrumbId);
+        }
+    }
+
     private void populateExchangeFromMessageContext(MessageContext messageContext, Exchange
exchange) {
         populateExchangeWithPropertiesFromMessageContext(messageContext, exchange);
 


Mime
View raw message