cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r956035 - in /cxf/trunk: api/src/main/java/org/apache/cxf/phase/ rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/
Date Fri, 18 Jun 2010 16:14:22 GMT
Author: dkulp
Date: Fri Jun 18 16:14:21 2010
New Revision: 956035

URL: http://svn.apache.org/viewvc?rev=956035&view=rev
Log:
[CXF-2856] Make sure the connection isn't opened twice for the HTTP
binding stuff

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
    cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=956035&r1=956034&r2=956035&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Fri Jun 18
16:14:21 2010
@@ -31,6 +31,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.continuations.SuspendedInvocationException;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
@@ -613,7 +614,11 @@ public class PhaseInterceptorChain imple
             } else {
                 chain.append(", ");
             }
-            chain.append(i.interceptor.getClass().getSimpleName());
+            String nm = i.interceptor.getClass().getSimpleName();
+            if (StringUtils.isEmpty(nm)) {
+                nm = i.interceptor.getId();
+            }
+            chain.append(nm);
             i = i.next;
         }
         chain.append("]\n");

Modified: cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java?rev=956035&r1=956034&r2=956035&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
Fri Jun 18 16:14:21 2010
@@ -33,6 +33,7 @@ import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.MapNamespaceContext;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
 import org.apache.cxf.interceptor.WrappedOutInterceptor;
 import org.apache.cxf.message.Message;
@@ -65,7 +66,6 @@ public class DatabindingOutSetupIntercep
                 nsMap.addNamespace(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
                 writer.setNamespaceContext(nsMap);
             } catch (XMLStreamException e) {
-                e.printStackTrace();
                 // ignore
             }
             message.setContent(XMLStreamWriter.class, writer);
@@ -74,10 +74,9 @@ public class DatabindingOutSetupIntercep
             wrappedOut.addAfter(getId());
             chain.add(wrappedOut);
 
-            XMLMessageOutInterceptor xmlOut = new XMLMessageOutInterceptor(Phase.PRE_LOGICAL);
+            final XMLMessageOutInterceptor xmlOut = new XMLMessageOutInterceptor(Phase.PRE_LOGICAL);
             xmlOut.addAfter(wrappedOut.getId());
             chain.add(xmlOut);
-            
 
             Endpoint ep = message.getExchange().get(Endpoint.class);
             URIMapper mapper = (URIMapper) ep.getService().get(URIMapper.class.getName());
@@ -88,9 +87,18 @@ public class DatabindingOutSetupIntercep
             boolean putOrPost = verb.equals(HttpConstants.POST) || verb.equals(HttpConstants.PUT);
             
             if (putOrPost) { 
-                chain.doIntercept(message);
                 chain.add(new URIParameterOutInterceptor());
                 chain.add(new DocumentWriterInterceptor());
+                chain.add(new AbstractPhaseInterceptor<Message>("remove-writer", 
+                        Phase.PREPARE_SEND) {
+                    {
+                        addAfter(xmlOut.getId());
+                        addBefore(MessageSenderInterceptor.class.getName());
+                    }
+                    public void handleMessage(Message message) throws Fault {
+                        message.removeContent(XMLStreamWriter.class);
+                    }
+                });
                 chain.add(STAX_OUT);
             } else {
                 chain.add(new URIParameterOutInterceptor());

Modified: cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java?rev=956035&r1=956034&r2=956035&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
Fri Jun 18 16:14:21 2010
@@ -22,6 +22,7 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Node;
 
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
@@ -36,7 +37,8 @@ public class DocumentWriterInterceptor e
     }
 
     public void handleMessage(Message message) throws Fault {
-        Document doc = message.getContent(Document.class);
+        Node n = message.getContent(Node.class);
+        Document doc = (Document)n;
         XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
         
         try {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java?rev=956035&r1=956034&r2=956035&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
Fri Jun 18 16:14:21 2010
@@ -38,13 +38,14 @@ import org.apache.cxf.staxutils.StaxUtil
 public class WrappedOutInterceptor extends AbstractOutDatabindingInterceptor {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(WrappedOutInterceptor.class);
 
-    private WrappedOutEndingInterceptor ending = new WrappedOutEndingInterceptor();
+    private final WrappedOutEndingInterceptor ending;
     
     public WrappedOutInterceptor() {
         this(Phase.MARSHAL);
     }
     public WrappedOutInterceptor(String phase) {
         super(phase);
+        ending = new WrappedOutEndingInterceptor(phase + "-ending");
         addBefore(BareOutInterceptor.class.getName());
     }
 
@@ -90,8 +91,8 @@ public class WrappedOutInterceptor exten
     }
     
     public class WrappedOutEndingInterceptor extends AbstractOutDatabindingInterceptor {
-        public WrappedOutEndingInterceptor() {
-            super(Phase.MARSHAL_ENDING);
+        public WrappedOutEndingInterceptor(String phase) {
+            super(phase);
         }
 
         public void handleMessage(Message message) throws Fault {



Mime
View raw message