protected void commit() throws IOException {
writeOutBoundHeaders(cr.getMetadata(), method);
}
});
} catch (IOException ex) {
throw new ClientHandlerException(ex);
}
final byte[] content = baos.toByteArray();
entMethod.setRequestEntity(new RequestEntity() {
@Override
public boolean isRepeatable() {
return true;
}
@Override
public void writeRequest(OutputStream out) throws IOException {
out.write(content);
}
@Override
public long getContentLength() {
return content.length;
}
@Override
public String getContentType() {
return re.getMediaType().toString();
}
});
}
} else {
writeOutBoundHeaders(cr.getHeaders(), method);
}
} else {
writeOutBoundHeaders(cr.getHeaders(), method);
// Follow redirects
method.setFollowRedirects(cr.getPropertyAsFeature(ApacheHttpClientConfig.PROPERTY_FOLLOW_REDIRECTS));
}
try {
httpClient.executeMethod(getHostConfiguration(httpClient, props), method, getHttpState(props));
} catch (Exception e) {
method.releaseConnection();
throw new ClientHandlerException(e);
}
}