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 2008/07/07 21:06:28 UTC

svn commit: r674595 - /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java

Author: dkulp
Date: Mon Jul  7 12:06:27 2008
New Revision: 674595

URL: http://svn.apache.org/viewvc?rev=674595&view=rev
Log:
[CXF-1669] Add flag to WSS4JOutInterceptor to allow enabling mtom.

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java?rev=674595&r1=674594&r2=674595&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java Mon Jul  7 12:06:27 2008
@@ -54,7 +54,10 @@
                           WSS4JOutInterceptor.class.getName() + "-Time");
     private WSS4JOutInterceptorInternal ending;
     private SAAJOutInterceptor saajOut = new SAAJOutInterceptor();
+    private boolean mtomEnabled;
     
+    
+
     public WSS4JOutInterceptor() {
         super();
         setPhase(Phase.PRE_PROTOCOL);
@@ -67,10 +70,25 @@
         this();
         setProperties(props);
     }
+    
+    public boolean isAllowMTOM() {
+        return mtomEnabled;
+    }
+    /**
+     * Enable or disable mtom with WS-Security.   By default MTOM is disabled as
+     * attachments would not get encrypted or be part of the signature.
+     * @param mtomEnabled
+     */
+    public void setAllowMTOM(boolean allowMTOM) {
+        this.mtomEnabled = allowMTOM;
+    }
+
     public void handleMessage(SoapMessage mc) throws Fault {
         //must turn off mtom when using WS-Sec so binary is inlined so it can
         //be properly signed/encrypted/etc...
-        mc.put(org.apache.cxf.message.Message.MTOM_ENABLED, false);
+        if (!mtomEnabled) {
+            mc.put(org.apache.cxf.message.Message.MTOM_ENABLED, false);
+        }
         
         if (mc.getContent(SOAPMessage.class) == null) {
             saajOut.handleMessage(mc);