mirror of https://github.com/apache/jclouds.git
content type should only be set if content exists
git-svn-id: http://jclouds.googlecode.com/svn/trunk@54 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
e14f10b75f
commit
c9b8f4c2e9
|
@ -76,8 +76,9 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient {
|
||||||
for (HttpRequestFilter filter : getRequestFilters()) {
|
for (HttpRequestFilter filter : getRequestFilters()) {
|
||||||
filter.filter(request);
|
filter.filter(request);
|
||||||
}
|
}
|
||||||
logger.trace("%1s - submitting request %2s", target, request);
|
logger.trace("%1s - converting request %2s", target, request);
|
||||||
connection = openJavaConnection(request);
|
connection = openJavaConnection(request);
|
||||||
|
logger.trace("%1s - submitting request %2s", target, connection);
|
||||||
HttpResponse response = getResponse(connection);
|
HttpResponse response = getResponse(connection);
|
||||||
logger.trace("%1s - received response %2s", target, response);
|
logger.trace("%1s - received response %2s", target, response);
|
||||||
|
|
||||||
|
@ -100,7 +101,8 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient {
|
||||||
}
|
}
|
||||||
operation.setException(e);
|
operation.setException(e);
|
||||||
} finally {
|
} finally {
|
||||||
// DO NOT disconnect, as it will also close the unconsumed outputStream from above.
|
// DO NOT disconnect, as it will also close the unconsumed
|
||||||
|
// outputStream from above.
|
||||||
// connection.disconnect();
|
// connection.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,9 +137,9 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient {
|
||||||
for (String value : request.getHeaders().get(header))
|
for (String value : request.getHeaders().get(header))
|
||||||
connection.setRequestProperty(header, value);
|
connection.setRequestProperty(header, value);
|
||||||
}
|
}
|
||||||
connection.setRequestProperty(HttpConstants.CONTENT_TYPE, request
|
|
||||||
.getContentType());
|
|
||||||
if (request.getContent() != null) {
|
if (request.getContent() != null) {
|
||||||
|
connection.setRequestProperty(HttpConstants.CONTENT_TYPE, request
|
||||||
|
.getContentType());
|
||||||
OutputStream out = connection.getOutputStream();
|
OutputStream out = connection.getOutputStream();
|
||||||
try {
|
try {
|
||||||
if (request.getContent() instanceof String) {
|
if (request.getContent() instanceof String) {
|
||||||
|
|
Loading…
Reference in New Issue