}
HttpResponseAndByteCount methodAndByteCount = performRestPut(
destinationBucketName, destinationObjectKey, metadata, null, null, false);
CopyObjectResultHandler handler = getXmlResponseSaxParser()
.parseCopyObjectResponse(
new HttpMethodReleaseInputStream(methodAndByteCount.getHttpResponse()));
// Release HTTP connection manually. This should already have been done by the
// HttpMethodReleaseInputStream class, but you can never be too sure...
releaseConnection(methodAndByteCount.getHttpResponse());
if(handler.isErrorResponse()) {
throw new ServiceException(
"Copy failed: Code=" + handler.getErrorCode() +
", Message=" + handler.getErrorMessage() +
", RequestId=" + handler.getErrorRequestId() +
", HostId=" + handler.getErrorHostId());
}
Map<String, Object> map = new HashMap<String, Object>();
// Result fields returned when copy is successful.
map.put("Last-Modified", handler.getLastModified());
map.put("ETag", handler.getETag());
// Include information about copy operation in result map, issue #192
map.put("X-JetS3t-SourceBucketName", sourceBucketName);
map.put("X-JetS3t-SourceObjectKey", sourceObjectKey);
map.put("X-JetS3t-DestinationBucketName", destinationBucketName);