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/01/07 16:37:43 UTC

svn commit: r896904 - in /cxf/branches/2.2.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/fronten...

Author: dkulp
Date: Thu Jan  7 15:33:20 2010
New Revision: 896904

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

........
  r896888 | dkulp | 2010-01-07 09:14:50 -0500 (Thu, 07 Jan 2010) | 2 lines
  
  [CXF-2594] During unwind on faults during output, with SAAJ, we can
  really fully unwind.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:896888

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

Modified: cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=896904&r1=896903&r2=896904&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Thu Jan  7 15:33:20 2010
@@ -76,7 +76,8 @@
     
     public void handleMessage(SoapMessage message) {
         // Yes this is ugly, but it avoids us from having to implement any kind of caching strategy
-        if (!MessageUtils.isTrue(message.get(WROTE_ENVELOPE_START))) {
+        boolean wroteStart = MessageUtils.isTrue(message.get(WROTE_ENVELOPE_START));
+        if (!wroteStart) {
             writeSoapEnvelopeStart(message);
             
             OutputStream os = message.getContent(OutputStream.class);

Modified: cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java?rev=896904&r1=896903&r2=896904&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java Thu Jan  7 15:33:20 2010
@@ -43,6 +43,7 @@
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.helpers.CastUtils;
@@ -147,6 +148,9 @@
     @Override
     public void handleFault(SoapMessage message) {
         super.handleFault(message);
+        //need to clear these so the fault writing will work correctly
+        message.removeContent(SOAPMessage.class);
+        message.remove(SoapOutInterceptor.WROTE_ENVELOPE_START);
         XMLStreamWriter writer = (XMLStreamWriter)message.get(ORIGINAL_XML_WRITER);
         if (writer != null) {
             message.setContent(XMLStreamWriter.class, writer);

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=896904&r1=896903&r2=896904&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java Thu Jan  7 15:33:20 2010
@@ -36,7 +36,8 @@
  * 
  */
 public class LoggingOutInterceptor extends AbstractPhaseInterceptor {
-   
+    private static final String LOG_SETUP = LoggingOutInterceptor.class.getName() + ".log-setup";
+    
     private static final Logger LOG = LogUtils.getL7dLogger(LoggingOutInterceptor.class); 
 
     private int limit = 100 * 1024;
@@ -75,9 +76,13 @@
 
         if (LOG.isLoggable(Level.INFO) || writer != null) {
             // Write the output while caching it for the log message
-            final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os);
-            message.setContent(OutputStream.class, newOut);
-            newOut.registerCallback(new LoggingCallback(message, os));
+            boolean hasLogged = message.containsKey(LOG_SETUP);
+            if (!hasLogged) {
+                message.put(LOG_SETUP, Boolean.TRUE);
+                final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(os);
+                message.setContent(OutputStream.class, newOut);
+                newOut.registerCallback(new LoggingCallback(message, os));
+            }
         }
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=896904&r1=896903&r2=896904&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java Thu Jan  7 15:33:20 2010
@@ -283,6 +283,9 @@
     }
 
     public void handleFault(SoapMessage message) {
+        if (getInvoker(message).getProtocolHandlers().isEmpty()) {
+            return;
+        }
         if (getInvoker(message).isOutbound() 
             && !chainAlreadyContainsSAAJ(message)) {
             SAAJ_OUT.handleFault(message);

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=896904&r1=896903&r2=896904&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Thu Jan  7 15:33:20 2010
@@ -537,8 +537,11 @@
          */
         public void prepare(Message message) throws IOException {
             message.put(HTTP_RESPONSE, response);
-            message.setContent(OutputStream.class, 
+            OutputStream os = message.getContent(OutputStream.class);
+            if (os == null) {
+                message.setContent(OutputStream.class, 
                                new WrappedOutputStream(message, response));
+            }
         }
     }