cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [08/14] cxf git commit: [CXF-6900, CXF-6908] More fixes for namespace issues with decrypted faults and adding faults to SAAJ envelopes
Date Mon, 25 Jul 2016 15:30:42 GMT
[CXF-6900, CXF-6908] More fixes for namespace issues with decrypted faults and adding faults
to SAAJ envelopes

# Conflicts:
#	rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSerializer.java
#	systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java


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

Branch: refs/heads/3.0.x-fixes
Commit: 35b808c661b9fe7702b5e875f08cc831fde05eeb
Parents: c372fb7
Author: Daniel Kulp <dkulp@apache.org>
Authored: Mon May 23 12:21:56 2016 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Jul 25 10:23:24 2016 -0400

----------------------------------------------------------------------
 .../cxf/binding/soap/saaj/SAAJStreamWriter.java | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/35b808c6/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index 185079b..8c13b1e 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.binding.soap.saaj;
 
+import java.util.Iterator;
+
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
@@ -26,6 +28,7 @@ import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPHeader;
 import javax.xml.soap.SOAPPart;
+import javax.xml.stream.XMLStreamException;
 
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -33,9 +36,11 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.staxutils.OverlayW3CDOMStreamWriter;
+import org.apache.cxf.staxutils.W3CNamespaceContext;
 
 import static org.apache.cxf.binding.soap.saaj.SAAJUtils.adjustPrefix;
 
+
 public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
     private final SOAPPart part;
     private final SOAPEnvelope envelope;
@@ -69,6 +74,25 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
         isOverlaid = false;
     }
     
+    @Override
+    public String getPrefix(String nsuri) throws XMLStreamException {
+        if (isOverlaid && part != null && getCurrentNode() == null) {
+            Node nd = part.getFirstChild();
+            while (nd != null) {
+                if (nd instanceof Element) {
+                    Iterator<String> it = new W3CNamespaceContext((Element)nd).getPrefixes(nsuri);
+                    if (it.hasNext()) {
+                        return it.next();
+                    } else {
+                        nd = null;
+                    }
+                } else {
+                    nd = nd.getNextSibling();
+                }
+            }
+        }
+        return super.getPrefix(nsuri);
+    }
     private String getEnvelopeURI() throws SOAPException {
         if (uri == null) {
             uri = getEnvelope().getElementName().getURI();


Mime
View raw message