cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ulhasbh...@apache.org
Subject svn commit: r696720 - in /cxf/trunk/rt/transports/jms/src: main/java/org/apache/cxf/transport/jms/JMSConstants.java main/java/org/apache/cxf/transport/jms/JMSUtils.java test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
Date Thu, 18 Sep 2008 17:10:28 GMT
Author: ulhasbhole
Date: Thu Sep 18 10:10:28 2008
New Revision: 696720

URL: http://svn.apache.org/viewvc?rev=696720&view=rev
Log:
* [CXF-1805] Use of Content-Type in JMS Header not in line with JMS specification

Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConstants.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConstants.java?rev=696720&r1=696719&r2=696720&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConstants.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConstants.java
Thu Sep 18 10:10:28 2008
@@ -21,6 +21,7 @@
 
 public final class JMSConstants {
     
+    public static final String JMS_CONTENT_TYPE = "SOAPJMS_contentType";
     public static final String JMS_QUEUE = "queue";
     public static final String JMS_TOPIC = "topic";
 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java?rev=696720&r1=696719&r2=696720&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java (original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSUtils.java Thu
Sep 18 10:10:28 2008
@@ -212,7 +212,9 @@
             props.add(prop);
 
             protHeaders.put(name, Collections.singletonList(val));
-            if (name.equals(org.apache.cxf.message.Message.CONTENT_TYPE) && val !=
null) {
+            if (name.equals(org.apache.cxf.message.Message.CONTENT_TYPE)
+                || name.equals(JMSConstants.JMS_CONTENT_TYPE) 
+                && val != null) {
                 inMessage.put(org.apache.cxf.message.Message.CONTENT_TYPE, val);
             }
 
@@ -237,7 +239,13 @@
                 value.append(s);
                 first = false;
             }
-            message.setStringProperty(entry.getKey(), value.toString());
+            //Incase if the Content-Type header key is Content-Type replace with JMS_Content_Type
+            if (entry.getKey().equals(org.apache.cxf.message.Message.CONTENT_TYPE)) {
+                message.setStringProperty(JMSConstants.JMS_CONTENT_TYPE, value.toString());
+            } else {
+                message.setStringProperty(entry.getKey(), value.toString());    
+            }
+            
         }
     }
 
@@ -255,14 +263,17 @@
         String contentType = (String)message.get(org.apache.cxf.message.Message.CONTENT_TYPE);
 
         Map<String, List<String>> headers = JMSUtils.getSetProtocolHeaders(message);
-        if (headers.get(org.apache.cxf.message.Message.CONTENT_TYPE) == null) {
-            List<String> ct = new ArrayList<String>();
-            ct.add(contentType);
-            headers.put(org.apache.cxf.message.Message.CONTENT_TYPE, ct);
+        List<String> ct;
+        if (headers.get(JMSConstants.JMS_CONTENT_TYPE) != null) {
+            ct = headers.get(JMSConstants.JMS_CONTENT_TYPE);
+        } else if (headers.get(org.apache.cxf.message.Message.CONTENT_TYPE) != null) {
+            ct = headers.get(org.apache.cxf.message.Message.CONTENT_TYPE);
         } else {
-            List<String> ct = headers.get(org.apache.cxf.message.Message.CONTENT_TYPE);
-            ct.add(contentType);
+            ct = new ArrayList<String>();
+            headers.put(JMSConstants.JMS_CONTENT_TYPE, ct);
         }
+        
+        ct.add(contentType);
     }
 
     public static boolean isDestinationStyleQueue(AddressType address) {

Modified: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java?rev=696720&r1=696719&r2=696720&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
(original)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
Thu Sep 18 10:10:28 2008
@@ -389,8 +389,8 @@
 
         assertTrue("property has been excluded, only CONTENT_TYPE should be here",
                 inHeader.getProperty().size() == 1);
-        assertTrue("property has been excluded, only CONTENT_TYPE should be here",
-                inHeader.getProperty().get(0).getName().equals(Message.CONTENT_TYPE));
+        assertTrue("property has been excluded, only " + JMSConstants.JMS_CONTENT_TYPE +
"should be here",
+                inHeader.getProperty().get(0).getName().equals(JMSConstants.JMS_CONTENT_TYPE));
         // wait for a while for the jms session recycling
         Thread.sleep(1000);
         destination.shutdown();



Mime
View raw message