Author: sergeyb Date: Wed Jun 29 08:09:43 2011 New Revision: 1140992 URL: http://svn.apache.org/viewvc?rev=1140992&view=rev Log: Merged revisions 1140990 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes
................ r1140990 | sergeyb | 2011-06-29 09:07:13 +0100 (Wed, 29 Jun 2011) | 9 lines Merged revisions 1140843 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1140843 | sergeyb | 2011-06-28 22:00:13 +0100 (Tue, 28 Jun 2011) | 1 line Minor update to HttpConduit to allow chunking for non-empty PUTs ........ ................ Modified: cxf/branches/2.3.x-fixes/ (props changed) cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Propchange: cxf/branches/2.3.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Wed Jun 29 08:09:43 2011 @@ -0,0 +1,2 @@ +/cxf/branches/2.4.x-fixes:1140990 +/cxf/trunk:1140843 Propchange: cxf/branches/2.3.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1140992&r1=1140991&r2=1140992&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original) +++ cxf/branches/2.3.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Wed Jun 29 08:09:43 2011 @@ -69,6 +69,7 @@ import org.apache.cxf.io.CachedOutputStr import org.apache.cxf.message.Exchange; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageContentsList; import org.apache.cxf.message.MessageImpl; import org.apache.cxf.message.MessageUtils; import org.apache.cxf.phase.PhaseInterceptorChain; @@ -179,6 +180,9 @@ public class HTTPConduit */ private static final String SC_HTTP_CONDUIT_SUFFIX = ".http-conduit"; + private static final String HTTP_POST_METHOD = "POST"; + private static final String HTTP_PUT_METHOD = "PUT"; + /** * JVM/System property name holding the hostname of the http proxy. */ @@ -631,8 +635,8 @@ public class HTTPConduit // DELETE does not work and empty PUTs cause misleading exceptions // if chunking is enabled // TODO : ensure chunking can be enabled for non-empty PUTs - if requested - if (connection.getRequestMethod().equals("POST") - && csPolicy.isAllowChunking()) { + if (csPolicy.isAllowChunking() + && isChunkingSupported(message, connection.getRequestMethod())) { //TODO: The chunking mode be configured or at least some // documented client constant. //use -1 and allow the URL connection to pick a default value @@ -676,6 +680,19 @@ public class HTTPConduit // We are now "ready" to "send" the message. } + protected boolean isChunkingSupported(Message message, String httpMethod) { + if (HTTP_POST_METHOD.equals(httpMethod)) { + return true; + } + if (HTTP_PUT_METHOD.equals(httpMethod)) { + MessageContentsList objs = MessageContentsList.getContentsList(message); + if (objs != null && objs.size() > 0) { + return true; + } + } + return false; + } + protected OutputStream createOutputStream(Message message, HttpURLConnection connection, boolean needToCacheRequest,
