You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/08/30 23:45:43 UTC

svn commit: r1163415 - in /cxf/branches/2.4.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/

Author: dkulp
Date: Tue Aug 30 21:45:42 2011
New Revision: 1163415

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

........
  r1163414 | dkulp | 2011-08-30 17:44:29 -0400 (Tue, 30 Aug 2011) | 1 line
  
  [CXF-3691] Fix sending of protocol headers with JMS transport
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/TibcoSoapActionInterceptor.java
    cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
    cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/TibcoSoapActionInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/TibcoSoapActionInterceptor.java?rev=1163415&r1=1163414&r2=1163415&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/TibcoSoapActionInterceptor.java (original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/TibcoSoapActionInterceptor.java Tue Aug 30 21:45:42 2011
@@ -19,6 +19,7 @@
 package org.apache.cxf.binding.soap.interceptor;
 
 import java.util.Map;
+import java.util.TreeMap;
 
 import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -43,6 +44,11 @@ public class TibcoSoapActionInterceptor 
     public void handleMessage(SoapMessage soapMessage) throws Fault {
         Map<String, Object> headers = (Map<String, Object>)soapMessage.get(Message.PROTOCOL_HEADERS);
         if (headers != null && headers.containsKey(SoapBindingConstants.SOAP_ACTION)) {
+            //need to flip to a case sensitive map.  The default
+            //is a case insensitive map, but in this case, we need 
+            //to use a case sensitive map to make sure both versions go out
+            headers = new TreeMap<String, Object>(headers);
+            soapMessage.put(Message.PROTOCOL_HEADERS, headers);
             headers.put(SOAPACTION_TIBCO, headers.get(SoapBindingConstants.SOAP_ACTION));
         }
     }

Modified: cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java?rev=1163415&r1=1163414&r2=1163415&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java (original)
+++ cxf/branches/2.4.x-fixes/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java Tue Aug 30 21:45:42 2011
@@ -158,7 +158,7 @@ public final class JMSUtils {
         Map<String, List<String>> headers = CastUtils.cast((Map)inMessage
             .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
         if (headers == null) {
-            headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+            headers = new TreeMap<String, List<String>>();
             inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, headers);
         }
         headers.put(JMSSpecConstants.JMS_MESSAGE_TYPE, Collections.singletonList(messageType));
@@ -194,7 +194,7 @@ public final class JMSUtils {
             }
 
             Map<String, List<String>> protHeaders
-                = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+                = new TreeMap<String, List<String>>();
             List<JMSPropertyType> props = messageProperties.getProperty();
             Enumeration enm = message.getPropertyNames();
             while (enm.hasMoreElements()) {
@@ -266,7 +266,7 @@ public final class JMSUtils {
                 Map<String, List<String>> headers = CastUtils.cast((Map)inMessage
                     .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
                 if (headers == null) {
-                    headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+                    headers = new TreeMap<String, List<String>>();
                     inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, headers);
                 }
                 try {
@@ -361,6 +361,7 @@ public final class JMSUtils {
         return normalizedEncoding;
     }
 
+    /*
     protected static void addProtocolHeaders(Message message, Map<String, List<String>> headers)
         throws JMSException {
         if (headers == null) {
@@ -386,7 +387,7 @@ public final class JMSUtils {
 
         }
     }
-
+*/
     public static void addContentTypeToProtocolHeader(org.apache.cxf.message.Message message) {
         String contentType = (String)message.get(org.apache.cxf.message.Message.CONTENT_TYPE);
         String enc = (String)message.get(org.apache.cxf.message.Message.ENCODING);
@@ -405,7 +406,7 @@ public final class JMSUtils {
         Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message
             .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
         if (null == headers) {
-            headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+            headers = new TreeMap<String, List<String>>();
             message.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, headers);
         }
 
@@ -608,7 +609,7 @@ public final class JMSUtils {
         Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)outMessage
             .get(org.apache.cxf.message.Message.PROTOCOL_HEADERS));
         if (headers != null) {
-            List<String> action = headers.get(SOAPConstants.SOAP_ACTION);
+            List<String> action = headers.remove(SOAPConstants.SOAP_ACTION);
             if (action != null && action.size() > 0) {
                 soapAction = action.get(0);
             }
@@ -635,6 +636,23 @@ public final class JMSUtils {
         if (!messageProperties.isSetSOAPJMSRequestURI()) {
             messageProperties.setSOAPJMSRequestURI(jmsConfig.getRequestURI());
         }
+        for (Map.Entry<String, List<String>> ent : headers.entrySet()) {
+            JMSPropertyType prop = new JMSPropertyType();
+            prop.setName(ent.getKey());
+            if (ent.getValue().size() > 1) {
+                StringBuilder b = new StringBuilder();
+                for (String s : ent.getValue()) {
+                    if (b.length() > 0) {
+                        b.append(',');
+                    }
+                    b.append(s);
+                }
+                prop.setValue(b.toString());
+            } else {
+                prop.setValue(ent.getValue().get(0));
+            }
+            messageProperties.getProperty().add(prop);
+        }
     }
 
     /**

Modified: cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=1163415&r1=1163414&r2=1163415&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java Tue Aug 30 21:45:42 2011
@@ -47,6 +47,7 @@ import javax.xml.ws.soap.SOAPFaultExcept
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.hello_world_jms.BadRecordLitFault;
@@ -156,6 +157,7 @@ public class JMSClientServerTest extends
             Greeter greeter = service.getPort(portName, Greeter.class);
             
             Client client = ClientProxy.getClient(greeter);
+            client.getEndpoint().getOutInterceptors().add(new TibcoSoapActionInterceptor());
             EndpointInfo ei = client.getEndpoint().getEndpointInfo();
             AddressType address = ei.getTraversedExtensor(new AddressType(), AddressType.class);
             JMSNamingPropertyType name = new JMSNamingPropertyType();