cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r503450 - in /incubator/cxf/trunk/rt/bindings: http/src/main/java/org/apache/cxf/binding/http/interceptor/ xml/src/main/java/org/apache/cxf/binding/xml/ xml/src/main/java/org/apache/cxf/binding/xml/interceptor/ xml/src/test/java/org/apache/...
Date Sun, 04 Feb 2007 18:19:48 GMT
Author: jliu
Date: Sun Feb  4 10:19:47 2007
New Revision: 503450

URL: http://svn.apache.org/viewvc?view=rev&rev=503450
Log:
Replace wrappedin and barein interceptors with DocLiteralInInterceptor.

Modified:
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.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/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java?view=diff&rev=503450&r1=503449&r2=503450
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingInSetupInterceptor.java
Sun Feb  4 10:19:47 2007
@@ -19,6 +19,7 @@
 package org.apache.cxf.binding.http.interceptor;
 
 import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.interceptor.StaxInInterceptor;
@@ -31,6 +32,7 @@
 
     private static final WrappedInInterceptor WRAPPED_IN = new WrappedInInterceptor();
     private static final XMLMessageInInterceptor XML_IN = new XMLMessageInInterceptor();
+    private static final DocLiteralInInterceptor DOCLIT_IN = new DocLiteralInInterceptor();
     private static final URIParameterInInterceptor URI_IN = new URIParameterInInterceptor();
     private static final StaxInInterceptor STAX_IN = new StaxInInterceptor();
     private static final DispatchInterceptor DISPATCH_IN = new DispatchInterceptor();
@@ -47,6 +49,7 @@
         if (client) {
             chain.add(WRAPPED_IN);
             chain.add(XML_IN);
+            chain.add(DOCLIT_IN);
             chain.add(STAX_IN);
         } else {
             chain.add(URI_IN);

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java?view=diff&rev=503450&r1=503449&r2=503450
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterInInterceptor.java
Sun Feb  4 10:19:47 2007
@@ -36,6 +36,7 @@
 import org.apache.cxf.binding.http.URIMapper;
 import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
 import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.message.Message;
@@ -82,6 +83,7 @@
         }
 
         message.getInterceptorChain().add(new XMLMessageInInterceptor());
+        message.getInterceptorChain().add(new DocLiteralInInterceptor());
 
         MessagePartInfo part = parts.get(0);
 

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?view=diff&rev=503450&r1=503449&r2=503450
==============================================================================
--- 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
Sun Feb  4 10:19:47 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
 import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
 import org.apache.cxf.interceptor.URIMappingInterceptor;
@@ -63,7 +64,8 @@
         xb.getInInterceptors().add(new StaxInInterceptor());
         xb.getInInterceptors().add(new XMLMessageInInterceptor());
         xb.getInInterceptors().add(new URIMappingInterceptor());
-        
+        xb.getInInterceptors().add(new DocLiteralInInterceptor());
+               
         xb.getInFaultInterceptors().add(new XMLFaultInInterceptor());
         
         xb.getOutInterceptors().add(new StaxOutInterceptor());

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?view=diff&rev=503450&r1=503449&r2=503450
==============================================================================
--- 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
Sun Feb  4 10:19:47 2007
@@ -32,9 +32,8 @@
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
-import org.apache.cxf.interceptor.BareInInterceptor;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.WrappedInInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
@@ -50,34 +49,31 @@
     private static final Logger LOG = Logger.getLogger(XMLMessageInInterceptor.class.getName());
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(XMLMessageInInterceptor.class);
     
-    // TODO: this should be part of the chain!!
-    private BareInInterceptor bareInterceptor = new BareInInterceptor();
-    private WrappedInInterceptor wrappedInterceptor = new WrappedInInterceptor();
-    
     public XMLMessageInInterceptor() {
         super();
         setPhase(Phase.UNMARSHAL);
+        addBefore(DocLiteralInInterceptor.class.getName());
     }
 
     public void handleMessage(Message message) throws Fault {
-        if (isGET(message)) {            
+        if (isGET(message)) {
             LOG.info("XMLMessageInInterceptor skipped in HTTP GET method");
             return;
         }
         Endpoint ep = message.getExchange().get(Endpoint.class);
-        
-        XMLStreamReader xsr = message.getContent(XMLStreamReader.class);        
-        DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr);        
+
+        XMLStreamReader xsr = message.getContent(XMLStreamReader.class);
+        DepthXMLStreamReader reader = new DepthXMLStreamReader(xsr);
         if (!StaxUtils.toNextElement(reader)) {
             throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_ELEMENT",
BUNDLE));
         }
-        
+
         Exchange ex = message.getExchange();
         QName startQName = reader.getName();
         // handling xml fault message
-        if (startQName.getLocalPart().equals(XMLFault.XML_FAULT_ROOT)) {            
+        if (startQName.getLocalPart().equals(XMLFault.XML_FAULT_ROOT)) {
             message.getInterceptorChain().abort();
-            
+
             if (ep.getInFaultObserver() != null) {
                 ep.getInFaultObserver().onMessage(message);
                 return;
@@ -95,29 +91,15 @@
                 ex.setOneWay(boi.getOperationInfo().isOneWay());
             }
         } else {
-            BindingMessageInfo bmi = isRequestor ? boi.getOutput()
-                                                 : boi.getInput();
+            BindingMessageInfo bmi = isRequestor ? boi.getOutput() : boi.getInput();
 
-            if (hasRootNode(bmi, startQName)) { 
+            if (hasRootNode(bmi, startQName)) {
                 try {
                     xsr.nextTag();
                 } catch (XMLStreamException xse) {
                     throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC",
BUNDLE));
                 }
             }
-        }
-
-        if (boi != null) {
-            OperationInfo oi = boi.getOperationInfo();
-            if (!oi.isUnwrappedCapable()) {
-                bareInterceptor.handleMessage(message);
-            } else {
-                wrappedInterceptor.handleMessage(message);
-            }
-        } else { 
-            throw new Fault(new org.apache.cxf.common.i18n.Message("REQ_NOT_UNDERSTOOD",

-                                                                   BUNDLE, 
-                                                                   startQName));
         }
     }
 

Modified: incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java?view=diff&rev=503450&r1=503449&r2=503450
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTest.java
Sun Feb  4 10:19:47 2007
@@ -25,6 +25,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.hello_world_xml_http.bare.types.MyComplexStructType;
@@ -33,6 +34,7 @@
 public class XMLMessageInInterceptorTest extends TestBase {
 
     XMLMessageInInterceptor in = new XMLMessageInInterceptor();
+    DocLiteralInInterceptor docLitIn = new DocLiteralInInterceptor();
 
     public void setUp() throws Exception {
         super.setUp();
@@ -51,6 +53,7 @@
         op.getInput().getMessagePartByIndex(1).setTypeClass(String.class);
         
         in.handleMessage(xmlMessage);
+        docLitIn.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);
         assertNotNull(list);
         assertEquals("expect 2 param", 2, list.size());
@@ -68,6 +71,7 @@
         op.getInput().getMessagePartByIndex(0).setTypeClass(String.class);
         
         in.handleMessage(xmlMessage);
+        docLitIn.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);
         assertNotNull(list);
         assertEquals("expect 1 param", 1, list.size());
@@ -84,6 +88,7 @@
         op.getInput().getMessagePartByIndex(0).setTypeClass(GreetMe.class);
         
         in.handleMessage(xmlMessage);
+        docLitIn.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);
         assertNotNull(list);
         assertEquals("expect 1 param", 1, list.size());



Mime
View raw message