Author: dkulp
Date: Thu Jan 7 23:44:39 2010
New Revision: 897058
URL: http://svn.apache.org/viewvc?rev=897058&view=rev
Log:
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.2.x-fixes/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
- copied unchanged from r897053,
cxf/trunk/api/src/main/java/org/apache/cxf/io/DelegatingInputStream.java
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=897058&r1=897057&r2=897058&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
Thu Jan 7 23:44:39 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;
@@ -59,6 +60,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());
@@ -71,12 +91,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.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=897058&r1=897057&r2=897058&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 23:44:39 2010
@@ -54,6 +54,7 @@
import org.apache.cxf.helpers.HttpHeaderHelper;
import org.apache.cxf.interceptor.Interceptor;
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;
@@ -276,7 +277,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.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?rev=897058&r1=897057&r2=897058&view=diff
==============================================================================
---
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
(original)
+++
cxf/branches/2.2.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
Thu Jan 7 23:44:39 2010
@@ -41,6 +41,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;
@@ -397,6 +398,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)