try {
String resourcePath =
"/" +
((bucketName != null) ? bucketName + "/" : "") +
((key != null) ? ServiceUtils.urlEncode(key) : "");
new S3Signer(awsCredentials, methodName.toString(), resourcePath).sign(request, null, null);
} catch (SignatureException e) {
throw new AmazonClientException("Unable to sign request: " + e.getMessage(), e);
}
}