Moved the setDoInput() on HttpURLConnection before sending any data on the connection.

disabled configuration settings on install in pom.xml that were interfering with the normal behavior of install.
This commit is contained in:
Inderjeet Singh 2008-09-15 17:00:26 +00:00
parent 2753213c2e
commit 82851d68be
3 changed files with 12 additions and 6 deletions

View File

@ -116,7 +116,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- configuration>
<updateReleaseInfo>true</updateReleaseInfo>
<createChecksum>true</createChecksum>
<groupId>${groupId}</groupId>
@ -125,7 +125,7 @@
<packaging>jar</packaging>
<classifier>sources</classifier>
<file>target/wsf-sources.jar</file>
</configuration>
</configuration -->
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>

View File

@ -44,12 +44,21 @@ public final class RequestSender {
try {
conn.setRequestMethod(request.getHttpMethod().toString());
conn.setRequestProperty("Content-Type", request.getContentType());
// Assume conservatively that the response will need to be read.
// This is done here instead of in the response receiver because this property must be set
// before sending any data on the connection.
conn.setDoInput(true);
addRequestParams(conn, request.getHeaders());
RequestBody requestBody = request.getBody();
if (requestBody.getSpec().size() > 0) {
conn.setDoOutput(true);
addRequestBody(conn, requestBody);
}
}
// Initiate the sending of the request.
conn.connect();
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -50,9 +50,6 @@ public final class ResponseReceiver {
try {
HeaderMapSpec paramSpec = spec.getHeadersSpec();
ResponseBodySpec bodySpec = spec.getBodySpec();
if (bodySpec.size() > 0) {
conn.setDoInput(true);
}
// read response
HeaderMap responseParams = readResponseHeaders(conn, paramSpec);
ResponseBody responseBody = readResponseBody(conn, bodySpec);