cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r604314 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/
Date Fri, 14 Dec 2007 22:19:26 GMT
Author: dkulp
Date: Fri Dec 14 14:19:24 2007
New Revision: 604314

URL: http://svn.apache.org/viewvc?rev=604314&view=rev
Log:
Merged revisions 604295 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r604295 | dkulp | 2007-12-14 16:09:46 -0500 (Fri, 14 Dec 2007) | 2 lines
  
  [CXF-1296] Support for reading from doms for Aegis.   Allow header interceptor to use StreamReaders
if nodes aren't supported
........

Added:
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/ElementDataReader.java
      - copied unchanged from r604295, incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/ElementDataReader.java
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java?rev=604314&r1=604313&r2=604314&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
Fri Dec 14 14:19:24 2007
@@ -21,6 +21,10 @@
 
 import java.util.List;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -37,6 +41,7 @@
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.W3CDOMStreamReader;
 
 /**
  * Perform databinding of the SOAP headers.
@@ -81,6 +86,7 @@
             return;
         }
         
+        boolean supportsNode = this.supportsDataReader(message, Node.class);
         for (SoapHeaderInfo header : headers) {
             MessagePartInfo mpi = header.getPart();
             Header param = findHeader(message, mpi);
@@ -91,7 +97,17 @@
                 
                 if (param.getDataBinding() == null) {
                     Node source = (Node)param.getObject();
-                    object = getNodeDataReader(message).read(mpi, source);
+                    if (supportsNode) {
+                        object = getNodeDataReader(message).read(mpi, source);
+                    } else {
+                        W3CDOMStreamReader reader = new W3CDOMStreamReader((Element)source);
+                        try {
+                            reader.nextTag(); //advance into the first tag
+                        } catch (XMLStreamException e) {
+                            //ignore
+                        } 
+                        object = getDataReader(message, XMLStreamReader.class).read(mpi,
reader);
+                    }
                 } else {
                     object = param.getObject();
                 }

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java?rev=604314&r1=604313&r2=604314&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
Fri Dec 14 14:19:24 2007
@@ -63,7 +63,17 @@
     protected boolean isRequestor(Message message) {
         return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
     }
-
+ 
+    protected boolean supportsDataReader(Message message, Class<?> input) {
+        Service service = ServiceModelUtil.getService(message.getExchange());
+        Class<?> cls[] = service.getDataBinding().getSupportedReaderFormats();
+        for (Class<?> c : cls) {
+            if (c.equals(input)) {
+                return true;
+            }
+        }
+        return false;
+    }
     protected <T> DataReader<T> getDataReader(Message message, Class<T>
input) {
         Service service = ServiceModelUtil.getService(message.getExchange());
         DataReader<T> dataReader = service.getDataBinding().createReader(input);

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=604314&r1=604313&r2=604314&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
Fri Dec 14 14:19:24 2007
@@ -103,6 +103,8 @@
     public <T> DataReader<T> createReader(Class<T> cls) {
         if (cls.equals(XMLStreamReader.class)) {
             return (DataReader<T>) new XMLStreamDataReader(this);
+        } else if (cls.equals(Node.class)) {
+            return (DataReader<T>) new ElementDataReader(this);
         } else {
             throw new UnsupportedOperationException();
         }
@@ -120,7 +122,7 @@
     }
 
     public Class<?>[] getSupportedReaderFormats() {
-        return new Class[] {XMLStreamReader.class};
+        return new Class[] {XMLStreamReader.class, Node.class};
     }
 
     public Class<?>[] getSupportedWriterFormats() {



Mime
View raw message