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:
ferncam1 2009-04-28 16:48:36 +00:00
parent e14f10b75f
commit c9b8f4c2e9
1 changed files with 6 additions and 4 deletions

View File

@ -76,8 +76,9 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient {
for (HttpRequestFilter filter : getRequestFilters()) {
filter.filter(request);
}
logger.trace("%1s - submitting request %2s", target, request);
logger.trace("%1s - converting request %2s", target, request);
connection = openJavaConnection(request);
logger.trace("%1s - submitting request %2s", target, connection);
HttpResponse response = getResponse(connection);
logger.trace("%1s - received response %2s", target, response);
@ -100,7 +101,8 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient {
}
operation.setException(e);
} 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();
}
}
@ -135,9 +137,9 @@ public class JavaUrlHttpFutureCommandClient implements HttpFutureCommandClient {
for (String value : request.getHeaders().get(header))
connection.setRequestProperty(header, value);
}
connection.setRequestProperty(HttpConstants.CONTENT_TYPE, request
.getContentType());
if (request.getContent() != null) {
connection.setRequestProperty(HttpConstants.CONTENT_TYPE, request
.getContentType());
OutputStream out = connection.getOutputStream();
try {
if (request.getContent() instanceof String) {