You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ri...@apache.org on 2014/03/17 15:46:20 UTC

[1/2] git commit: CAMEL-7231: Support receiving attachments with Spring-WS

Repository: camel
Updated Branches:
  refs/heads/master 3e7dbf574 -> 6a23191c8


CAMEL-7231: Support receiving attachments with Spring-WS


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

Branch: refs/heads/master
Commit: fd8bfb691ef3000e7f763895b943377da3ea96d3
Parents: f105ac2
Author: Richard Kettelerij <r....@avisi.nl>
Authored: Mon Mar 17 15:45:10 2014 +0100
Committer: Richard Kettelerij <r....@avisi.nl>
Committed: Mon Mar 17 15:45:10 2014 +0100

----------------------------------------------------------------------
 .../spring/ws/SpringWebserviceConsumer.java     | 25 ++++++++++++++++----
 1 file changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fd8bfb69/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 4a5ee7d..5514ff5 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
@@ -32,6 +32,8 @@ import org.apache.camel.impl.DefaultConsumer;
 import org.apache.camel.impl.DefaultExchange;
 import org.springframework.ws.WebServiceMessage;
 import org.springframework.ws.context.MessageContext;
+import org.springframework.ws.mime.Attachment;
+import org.springframework.ws.mime.MimeMessage;
 import org.springframework.ws.server.endpoint.MessageEndpoint;
 import org.springframework.ws.soap.SoapHeader;
 import org.springframework.ws.soap.SoapHeaderElement;
@@ -44,7 +46,7 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
 
     public SpringWebserviceConsumer(Endpoint endpoint, Processor processor) {
         super(endpoint, processor);
-        this.endpoint = (SpringWebserviceEndpoint) endpoint;
+        this.endpoint = (SpringWebserviceEndpoint)endpoint;
         this.configuration = this.endpoint.getConfiguration();
     }
 
@@ -81,10 +83,12 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
         WebServiceMessage request = messageContext.getRequest();
         SpringWebserviceMessage inMessage = new SpringWebserviceMessage(request);
         extractSourceFromSoapHeader(inMessage.getHeaders(), request);
+        extractAttachmentsFromRequest(request, inMessage);
         exchange.setIn(inMessage);
     }
 
-    private void populateExchangeWithPropertiesFromMessageContext(MessageContext messageContext, Exchange exchange) {
+    private void populateExchangeWithPropertiesFromMessageContext(MessageContext messageContext,
+                                                                  Exchange exchange) {
         // convert WebserviceMessage properties (added through interceptors) to
         // Camel exchange properties
         String[] propertyNames = messageContext.getPropertyNames();
@@ -100,12 +104,12 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
      * it as a header with the key SpringWebserviceConstants.SPRING_WS_SOAP_HEADER
      * and a value of type Source.
      *
-     * @param headers   the Exchange Headers
-     * @param request   the WebService Request
+     * @param headers the Exchange Headers
+     * @param request the WebService Request
      */
     private void extractSourceFromSoapHeader(Map<String, Object> headers, WebServiceMessage request) {
         if (request instanceof SoapMessage) {
-            SoapMessage soapMessage = (SoapMessage) request;
+            SoapMessage soapMessage = (SoapMessage)request;
             SoapHeader soapHeader = soapMessage.getSoapHeader();
 
             if (soapHeader != null) {
@@ -131,6 +135,17 @@ public class SpringWebserviceConsumer extends DefaultConsumer implements Message
         }
     }
 
+    private void extractAttachmentsFromRequest(final WebServiceMessage request,
+                                               final SpringWebserviceMessage inMessage) {
+        if (request instanceof MimeMessage) {
+            Iterator<Attachment> attachmentsIterator = ((MimeMessage)request).getAttachments();
+            while (attachmentsIterator.hasNext()) {
+                Attachment attachment = attachmentsIterator.next();
+                inMessage.addAttachment(attachment.getContentId(), attachment.getDataHandler());
+            }
+        }
+    }
+
     @Override
     protected void doStop() throws Exception {
         if (configuration.getEndpointMapping() != null) {


[2/2] git commit: Merge remote-tracking branch 'origin/master'

Posted by ri...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/master
Commit: 6a23191c8a19bfb41087271f9512b7ede01604d4
Parents: fd8bfb6 3e7dbf5
Author: Richard Kettelerij <r....@avisi.nl>
Authored: Mon Mar 17 15:45:37 2014 +0100
Committer: Richard Kettelerij <r....@avisi.nl>
Committed: Mon Mar 17 15:45:37 2014 +0100

----------------------------------------------------------------------
 .../org/apache/camel/builder/SimpleBuilder.java |   6 +-
 .../camel/language/simple/SimpleLanguage.java   |   9 +-
 .../language/simple/SimplePredicateParser.java  |   9 ++
 .../simple/SimpleParserPredicateTest.java       |  12 +++
 .../SimpleRouteExpressionAsPredicateTest.java   |  51 +++++++++
 .../component/sjms/CamelJmsTestHelper.java      |  83 +++++++++++++++
 .../consumer/InOutConcurrentConsumerTest.java   |  80 ++++++++++++++
 .../itest/osgi/OSGiIntegrationTestSupport.java  |   2 +
 .../camel/itest/karaf/org.ops4j.pax.url.mvn.cfg | 103 +++++++++++++++++++
 9 files changed, 347 insertions(+), 8 deletions(-)
----------------------------------------------------------------------