cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r645934 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/ rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/ rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/
Date Tue, 08 Apr 2008 14:11:18 GMT
Author: dkulp
Date: Tue Apr  8 07:11:16 2008
New Revision: 645934

URL: http://svn.apache.org/viewvc?rev=645934&view=rev
Log:
[CXF-1464] The full set of fixes that were needed for the 2.0.x branch

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=645934&r1=645933&r2=645934&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Tue Apr  8 07:11:16 2008
@@ -202,7 +202,11 @@
 
         if (namespace.length() > 0) {
             writer.writeStartElement(prefix, name, namespace);
-            writer.writeNamespace(prefix, namespace);
+            if (prefix.length() > 0) {
+                writer.writeNamespace(prefix, namespace);
+            } else {
+                writer.writeDefaultNamespace(namespace);
+            }
         } else {
             writer.writeStartElement(name);
             writer.writeDefaultNamespace("");

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java?rev=645934&r1=645933&r2=645934&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
Tue Apr  8 07:11:16 2008
@@ -31,6 +31,7 @@
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
 import org.apache.cxf.interceptor.URIMappingInterceptor;
+import org.apache.cxf.interceptor.WrappedOutInterceptor;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -44,12 +45,13 @@
         if (!Boolean.TRUE.equals(binding.getProperty(DATABINDING_DISABLED))) {
             xb.getInInterceptors().add(new AttachmentInInterceptor());    
             xb.getInInterceptors().add(new StaxInInterceptor());
-            xb.getOutInterceptors().add(new StaxOutInterceptor());
-            
             xb.getInInterceptors().add(new URIMappingInterceptor());
-            xb.getOutInterceptors().add(new XMLMessageOutInterceptor());
             xb.getInInterceptors().add(new DocLiteralInInterceptor());
             xb.getInInterceptors().add(new XMLMessageInInterceptor());
+
+            xb.getOutInterceptors().add(new StaxOutInterceptor());
+            xb.getOutInterceptors().add(new WrappedOutInterceptor());
+            xb.getOutInterceptors().add(new XMLMessageOutInterceptor());            
         }        
 
         xb.getInFaultInterceptors().add(new XMLFaultInInterceptor());

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java?rev=645934&r1=645933&r2=645934&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptor.java
Tue Apr  8 07:11:16 2008
@@ -135,6 +135,19 @@
                 }
             }
         }
+        if (match == null) {
+            for (BindingOperationInfo boi : bi.getOperations()) {
+                if (startQName.equals(boi.getName())) {
+                    match = boi;
+                    //Consume The rootNode tag
+                    try {
+                        xsr.nextTag();
+                    } catch (XMLStreamException xse) {
+                        throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC",
LOG));
+                    }
+                }
+            } 
+        }
         return match;
     }
 

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java?rev=645934&r1=645933&r2=645934&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
Tue Apr  8 07:11:16 2008
@@ -27,6 +27,7 @@
 
 import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
 import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.interceptor.BareOutInterceptor;
 import org.apache.cxf.interceptor.Fault;
@@ -66,8 +67,10 @@
         if (xmf != null) {
             rootInModel = xmf.getRootNode();
         }
-        if (!boi.isUnwrapped() && mi.getMessageParts().size() == 1) {
-            // bare-one-param
+        if (boi.isUnwrapped() 
+            || mi.getMessageParts().size() == 1) {
+            // wrapper out interceptor created the wrapper
+            // or if bare-one-param
             new BareOutInterceptor().handleMessage(message);
         } else {
             if (rootInModel == null) {
@@ -93,8 +96,12 @@
     private void writeMessage(Message message, QName name, boolean executeBare) {
         XMLStreamWriter xmlWriter = message.getContent(XMLStreamWriter.class);
         try {
+            String pfx = name.getPrefix();
+            if (StringUtils.isEmpty(pfx)) {
+                pfx = "ns1";
+            }
             StaxUtils.writeStartElement(xmlWriter,
-                                        name.getPrefix(),
+                                        pfx,
                                         name.getLocalPart(),
                                         name.getNamespaceURI());
             if (executeBare) {



Mime
View raw message