Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes df909075a -> 58ea0b97d


[CXF-5649]Enable configuration for JMS message type to be byte when use MTOM


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

Branch: refs/heads/2.7.x-fixes
Commit: 58ea0b97dbc02ae959f48089384fbf906c813b9a
Parents: df90907
Author: Freeman Fang <[email protected]>
Authored: Thu Mar 27 14:35:51 2014 +0800
Committer: Freeman Fang <[email protected]>
Committed: Thu Mar 27 14:35:51 2014 +0800

----------------------------------------------------------------------
 .../org/apache/cxf/transport/jms/JMSDestination.java  | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/58ea0b97/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
----------------------------------------------------------------------
diff --git 
a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
 
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
index 4bc2c52..b6ce449 100644
--- 
a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
+++ 
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
@@ -48,6 +48,7 @@ import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.configuration.ConfigurationException;
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
@@ -294,8 +295,10 @@ public class JMSDestination extends 
AbstractMultiplexDestination
             final javax.jms.Message request = (javax.jms.Message)inMessage
                 .get(JMSConstants.JMS_REQUEST_MESSAGE);
             final String msgType;
-            if (isMtomEnabled(outMessage)) {
-                msgType = JMSConstants.BINARY_MESSAGE_TYPE;
+            if (isMtomEnabled(outMessage) 
+                && 
!jmsConfig.getMessageType().equals(JMSConstants.TEXT_MESSAGE_TYPE)) {
+                //get chance to set messageType from JMSConfiguration with 
MTOM enabled
+                msgType = jmsConfig.getMessageType();
             } else if (request instanceof TextMessage) {
                 msgType = JMSConstants.TEXT_MESSAGE_TYPE;
             } else if (request instanceof BytesMessage) {
@@ -303,6 +306,13 @@ public class JMSDestination extends 
AbstractMultiplexDestination
             } else {
                 msgType = JMSConstants.BINARY_MESSAGE_TYPE;
             }
+            
+            
+            if (JMSConstants.TEXT_MESSAGE_TYPE.equals(msgType) && 
isMtomEnabled(outMessage)) {
+                org.apache.cxf.common.i18n.Message msg = 
+                    new 
org.apache.cxf.common.i18n.Message("INVALID_MESSAGE_TYPE", LOG);
+                throw new ConfigurationException(msg);
+            }
 
             Destination replyTo = getReplyToDestination(jmsTemplate, 
inMessage);
 

Reply via email to