Small performance improvement

This commit is contained in:
Arjen Poutsma 2011-01-26 14:43:34 +00:00
parent f26b499cbd
commit 4e50eafe74
1 changed files with 8 additions and 1 deletions

View File

@ -65,10 +65,17 @@ final class BufferingSimpleClientHttpRequest extends AbstractBufferingClientHttp
this.connection.addRequestProperty(headerName, headerValue);
}
}
if (this.connection.getDoOutput()) {
this.connection.setFixedLengthStreamingMode(bufferedOutput.length);
}
this.connection.connect();
if (bufferedOutput.length > 0) {
if (this.connection.getDoOutput()) {
FileCopyUtils.copy(bufferedOutput, this.connection.getOutputStream());
}
return new SimpleClientHttpResponse(this.connection);
}