Author: richard.opalka(a)jboss.com
Date: 2011-01-31 11:09:03 -0500 (Mon, 31 Jan 2011)
New Revision: 13656
Modified:
thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Log:
[JBPAPP-4564][JBWS-3084][CXF-3065] back porting CXF-3065
Modified:
thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java 2011-01-31
16:06:24 UTC (rev 13655)
+++
thirdparty/cxf/branches/cxf-2.2.6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java 2011-01-31
16:09:03 UTC (rev 13656)
@@ -1701,7 +1701,9 @@
}
message.put(KEY_HTTP_CONNECTION, connection);
- connection.setFixedLengthStreamingMode(stream.size());
+ if (stream != null) {
+ connection.setFixedLengthStreamingMode(stream.size());
+ }
// Need to set the headers before the trust decision
// because they are set before the connect().
@@ -1978,8 +1980,10 @@
if (!cachingForRetransmission) {
super.close();
} else {
- cachedStream.getOut().close();
- cachedStream.closeFlowthroughStream();
+ if (cachedStream != null) {
+ cachedStream.getOut().close();
+ cachedStream.closeFlowthroughStream();
+ }
}
try {
handleResponse();
@@ -2025,9 +2029,10 @@
*/
protected void handleRetransmits() throws IOException {
// If we have a cachedStream, we are caching the request.
- if (cachedStream != null) {
+ if (cachedStream != null
+ || ("GET".equals(connection.getRequestMethod()) &&
getClient().isAutoRedirect())) {
- if (LOG.isLoggable(Level.FINE)) {
+ if (LOG.isLoggable(Level.FINE) && cachedStream != null) {
LOG.fine("Conduit \""
+ getConduitName()
+ "\" Transmit cached message to: "
@@ -2157,7 +2162,7 @@
//not going to be resending or anything, clear out the stuff in the out
message
//to free memory
outMessage.removeContent(OutputStream.class);
- if (cachingForRetransmission) {
+ if (cachingForRetransmission && cachedStream != null) {
cachedStream.close();
}
cachedStream = null;
Show replies by date