amazonwebservices/aws-sdk-for-java — pull request #3 by xoba (2011-11-08 15:46:11+00:00)
Title: explicit inheritance of com.amazonaws.AmazonWebServiceClient's methods fo

explicit inheritance of com.amazonaws.AmazonWebServiceClient's methods for all aws service interfaces, like com.amazonaws.services.s3.AmazonS3.

in particular, this exposes the method "addRequestHandler," which is convenient for "requester pays buckets" where
you use a com.amazonaws.handlers.RequestHandler to add the "x-amz-request-payer: requester" header. without this new feature,
one is forced to use class com.amazonaws.services.s3.AmazonS3Client, instead of interface com.amazonaws.services.s3.AmazonS3;
the latter is sort of preferred from basic object-oriented programming principles.

for instance: here's how i now can access a request-pays bucket:

AmazonS3 s3 = ................;

s3.addRequestHandler(new AbstractRequestHandler() {
@Override
public void beforeRequest(Request request) {
request.addHeader("x-amz-request-payer", "requester");
System.out.println("added request payer: " + request);
}
});

for (S3ObjectSummary s : s3.listObjects("commoncrawl-crawl-002").getObjectSummaries()) {
System.out.println(s.getKey());
}