Author: ffang Date: Thu Mar 5 06:36:00 2009 New Revision: 750336 URL: http://svn.apache.org/viewvc?rev=750336&view=rev Log: Merged revisions 750317 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes
................ r750317 | ffang | 2009-03-05 13:13:09 +0800 (Thu, 05 Mar 2009) | 9 lines Merged revisions 749966 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r749966 | ffang | 2009-03-04 19:20:13 +0800 (Wed, 04 Mar 2009) | 1 line [CXF-2082]client using decoupled ws-addressing with async handler hang from time to time ........ ................ Modified: cxf/branches/2.0.x-fixes/ (props changed) cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=750336&r1=750335&r2=750336&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original) +++ cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Thu Mar 5 06:36:00 2009 @@ -51,8 +51,10 @@ import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.helpers.HttpHeaderHelper; +import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.io.AbstractWrappedOutputStream; import org.apache.cxf.io.CacheAndWriteOutputStream; +import org.apache.cxf.io.CachedOutputStream; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; @@ -74,6 +76,7 @@ import org.apache.cxf.wsdl.EndpointReferenceUtils; + import static org.apache.cxf.message.Message.DECOUPLED_CHANNEL_MESSAGE; @@ -1927,7 +1930,6 @@ // Process retransmits until we fall out. handleRetransmits(); - if (outMessage == null || outMessage.getExchange() == null || outMessage.getExchange().isSynchronous()) { @@ -2050,8 +2052,8 @@ if (in == null) { LOG.log(Level.WARNING, "Input Stream is null!"); } - inMessage.setContent(InputStream.class, in); + inMessage.setContent(InputStream.class, in); incomingObserver.onMessage(inMessage); } @@ -2082,8 +2084,20 @@ inMessage.remove(AbstractHTTPDestination.HTTP_REQUEST); inMessage.remove(AbstractHTTPDestination.HTTP_RESPONSE); inMessage.remove(Message.ASYNC_POST_RESPONSE_DISPATCH); - - incomingObserver.onMessage(inMessage); + + //cache this inputstream since it's defer to use in case of async + try { + InputStream in = inMessage.getContent(InputStream.class); + if (in != null) { + CachedOutputStream cos = new CachedOutputStream(); + IOUtils.copy(in, cos); + inMessage.setContent(InputStream.class, cos.getInputStream()); + } + incomingObserver.onMessage(inMessage); + } catch (IOException e) { + e.printStackTrace(); + } + } }
