You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/06/18 18:33:24 UTC

svn commit: r956042 - in /cxf/branches/2.2.x-fixes: ./ 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/

Author: dkulp
Date: Fri Jun 18 16:33:23 2010
New Revision: 956042

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

........
  r956035 | dkulp | 2010-06-18 12:14:21 -0400 (Fri, 18 Jun 2010) | 2 lines
  
  [CXF-2856] Make sure the connection isn't opened twice for the HTTP
  binding stuff
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
    cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java

Propchange: cxf/branches/2.2.x-fixes/
            ('svn:mergeinfo' removed)

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

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=956042&r1=956041&r2=956042&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Fri Jun 18 16:33:23 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/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java?rev=956042&r1=956041&r2=956042&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DatabindingOutSetupInterceptor.java Fri Jun 18 16:33:23 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/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java?rev=956042&r1=956041&r2=956042&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/DocumentWriterInterceptor.java Fri Jun 18 16:33:23 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/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java?rev=956042&r1=956041&r2=956042&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java Fri Jun 18 16:33:23 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 {