You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/02/06 17:30:50 UTC

cxf git commit: Remove MTOM attachments if requested by the callback

Repository: cxf
Updated Branches:
  refs/heads/master fee77a894 -> e5b9f0e16


Remove MTOM attachments if requested by the callback


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

Branch: refs/heads/master
Commit: e5b9f0e1695e73c33a40248d45fa4eba034d39b3
Parents: fee77a8
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Feb 6 17:30:28 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Feb 6 17:30:28 2017 +0000

----------------------------------------------------------------------
 .../cxf/ws/security/wss4j/AttachmentCallbackHandler.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e5b9f0e1/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java
index 0539476..f1f8482 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/AttachmentCallbackHandler.java
@@ -62,7 +62,7 @@ public class AttachmentCallbackHandler implements CallbackHandler {
                     // Load all attachments
                     attachmentId = null;
                 }
-                loadAttachments(attachmentList, attachmentId);
+                loadAttachments(attachmentList, attachmentId, attachmentRequestCallback.isRemoveAttachments());
             } else if (callback instanceof AttachmentResultCallback) {
                 AttachmentResultCallback attachmentResultCallback = (AttachmentResultCallback) callback;
                 
@@ -96,7 +96,8 @@ public class AttachmentCallbackHandler implements CallbackHandler {
 
     private void loadAttachments(
         List<org.apache.wss4j.common.ext.Attachment> attachmentList,
-        String attachmentId
+        String attachmentId,
+        boolean removeAttachments
     ) throws IOException {
         final Collection<org.apache.cxf.message.Attachment> attachments = soapMessage.getAttachments();
         // Calling LazyAttachmentCollection.size() here to force it to load the attachments
@@ -121,7 +122,9 @@ public class AttachmentCallbackHandler implements CallbackHandler {
                 }
                 attachmentList.add(att);
 
-                iterator.remove();
+                if (removeAttachments) {
+                    iterator.remove();
+                }
             }
         }
     }