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/08 15:43:12 UTC

svn commit: r897218 - in /cxf/branches/2.1.x-fixes: ./ api/src/main/java/org/apache/cxf/io/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/ws/addr/src/main/java/org/apache/cxf/ws/add...

Author: dkulp
Date: Fri Jan  8 14:43:11 2010
New Revision: 897218

URL: http://svn.apache.org/viewvc?rev=897218&view=rev
Log:
Merged revisions 897058 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes

................
  r897058 | dkulp | 2010-01-07 18:44:39 -0500 (Thu, 07 Jan 2010) | 11 lines
  
  Merged revisions 897053 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r897053 | dkulp | 2010-01-07 18:31:38 -0500 (Thu, 07 Jan 2010) | 3 lines
    
    [CXF-2545] When pushing a message onto a background thread, we need to
    suck in all the data from the input stream and cache it as the transport
    may close the original stream when the current stack unwinds.
  ........
................

Added:
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
      - copied unchanged from r897058, cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
    cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java

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

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=897218&r1=897217&r2=897218&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java Fri Jan  8 14:43:11 2010
@@ -25,6 +25,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.io.DelegatingInputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -60,6 +61,25 @@
             
             message.put(OneWayProcessorInterceptor.class, this);
             final InterceptorChain chain = message.getInterceptorChain();
+
+            Object o = message.getContextualProperty(USE_ORIGINAL_THREAD);
+            if (o == null) {
+                o = Boolean.FALSE;
+            } else if (o instanceof String) {
+                o = Boolean.valueOf((String)o);
+            }
+
+            
+            if (Boolean.FALSE.equals(o)) {
+                //need to suck in all the data from the input stream as
+                //the transport might discard any data on the stream when this 
+                //thread unwinds or when the empty response is sent back
+                DelegatingInputStream in = message.get(DelegatingInputStream.class);
+                if (in != null) {
+                    in.cacheInput();
+                }
+            }
+
             
             try {
                 Message partial = createMessage(message.getExchange());
@@ -72,12 +92,6 @@
                 //IGNORE
             }
             
-            Object o = message.getContextualProperty(USE_ORIGINAL_THREAD);
-            if (o == null) {
-                o = Boolean.FALSE;
-            } else if (o instanceof String) {
-                o = Boolean.valueOf((String)o);
-            }
             if (Boolean.FALSE.equals(o)) {
                 chain.pause();
                 try {

Modified: cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=897218&r1=897217&r2=897218&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Fri Jan  8 14:43:11 2010
@@ -52,6 +52,7 @@
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
 import org.apache.cxf.io.AbstractWrappedOutputStream;
+import org.apache.cxf.io.DelegatingInputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.security.SecurityContext;
@@ -261,7 +262,9 @@
                                 final HttpServletRequest req, 
                                 final HttpServletResponse resp) throws IOException {
 
-        inMessage.setContent(InputStream.class, req.getInputStream());
+        DelegatingInputStream in = new DelegatingInputStream(req.getInputStream());
+        inMessage.setContent(DelegatingInputStream.class, in);
+        inMessage.setContent(InputStream.class, in);
         inMessage.put(HTTP_REQUEST, req);
         inMessage.put(HTTP_RESPONSE, resp);
         inMessage.put(HTTP_CONTEXT, context);

Modified: cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=897218&r1=897217&r2=897218&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ cxf/branches/2.1.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Fri Jan  8 14:43:11 2010
@@ -40,6 +40,7 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.interceptor.OutgoingChainInterceptor;
+import org.apache.cxf.io.DelegatingInputStream;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
@@ -396,6 +397,14 @@
                     }
                     
                     if (retrieveAsyncPostResponseDispatch(inMessage)) {
+                        //need to suck in all the data from the input stream as
+                        //the transport might discard any data on the stream when this 
+                        //thread unwinds or when the empty response is sent back
+                        DelegatingInputStream in = inMessage.get(DelegatingInputStream.class);
+                        if (in != null) {
+                            in.cacheInput();
+                        }
+                        
                         // async service invocation required *after* a response
                         // has been sent (i.e. to a oneway, or a partial response
                         // to a decoupled twoway)