public int put(String encodedUrl, InputStream content, Long contentLength, String contentType, ProgressListener listener) {
LogUtils.trace(log, "put: ", encodedUrl);
notifyStartRequest();
String s = encodedUrl;
PutMethod p = new PutMethod(s);
HttpMethodParams params = new HttpMethodParams();
params.setSoTimeout(timeout);
p.setParams(params);
NotifyingFileInputStream notifyingIn = null;
try {
notifyingIn = new NotifyingFileInputStream(content, contentLength, s, listener);
RequestEntity requestEntity;
if (contentLength == null) {
log.trace("no content length");
requestEntity = new InputStreamRequestEntity(notifyingIn, contentType);
} else {
requestEntity = new InputStreamRequestEntity(notifyingIn, contentLength, contentType);
}
p.setRequestEntity(requestEntity);
int result = client.executeMethod(p);
return result;
} catch (IOException ex) {
throw new RuntimeException(ex);
} finally {
IOUtils.closeQuietly(notifyingIn);
p.releaseConnection();
notifyFinishRequest();
}
}