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 2010/06/01 18:49:21 UTC

svn commit: r950156 - /cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptor.java

Author: dkulp
Date: Tue Jun  1 16:49:21 2010
New Revision: 950156

URL: http://svn.apache.org/viewvc?rev=950156&view=rev
Log:
Make sure the MTOM policy assertion works on client side

Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptor.java

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptor.java?rev=950156&r1=950155&r2=950156&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMPolicyInterceptor.java Tue Jun  1 16:49:21 2010
@@ -23,6 +23,7 @@ import java.util.Collection;
 
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.ws.policy.AssertionInfo;
@@ -40,13 +41,18 @@ public class MTOMPolicyInterceptor exten
         if (aim != null) {
             Collection<AssertionInfo> ais = aim.get(MetadataConstants.MTOM_ASSERTION_QNAME);
             for (AssertionInfo ai : ais) {
-                
-                // set mtom enabled and assert the policy if we find an mtom request
-                String contentType = (String)message.getExchange().getInMessage()
-                    .get(Message.CONTENT_TYPE);
-                if (contentType != null && contentType.contains("type=\"application/xop+xml\"")) {
-                    ai.setAsserted(true);
+                if (MessageUtils.isRequestor(message)) {
+                    //just turn on MTOM
                     message.put(Message.MTOM_ENABLED, Boolean.TRUE);
+                    ai.setAsserted(true);
+                } else {
+                    // set mtom enabled and assert the policy if we find an mtom request
+                    String contentType = (String)message.getExchange().getInMessage()
+                        .get(Message.CONTENT_TYPE);
+                    if (contentType != null && contentType.contains("type=\"application/xop+xml\"")) {
+                        ai.setAsserted(true);
+                        message.put(Message.MTOM_ENABLED, Boolean.TRUE);
+                    }
                 }
             }
         }