HttpMethod httpMethod;
if (isPost || isPut) {
EntityEnclosingMethod entityEnclosingMethod =
isPost ? new PostMethod(url) : new PutMethod(url);
if (body != null) {
ExcerptInputStream e = new ExcerptInputStream(body);
String length = request.removeHeaders(HttpMessage.CONTENT_LENGTH);
entityEnclosingMethod.setRequestEntity((length == null)
? new InputStreamRequestEntity(e)
: new InputStreamRequestEntity(e, Long.parseLong(length)));
excerpt = e.getExcerpt();
}
httpMethod = entityEnclosingMethod;
} else if (isDelete) {
httpMethod = new DeleteMethod(url);
} else {