public List<S3Bucket> getBuckets() {
List<S3Bucket> result = new ArrayList<S3Bucket>();
// Fetch a resource: an XML document with our list of buckets
Response response = authorizedGet(HOST);
DomRepresentation document = new DomRepresentation(response.getEntity());
if (response.getStatus().isSuccess()) {
// Use XPath to find the bucket names
for (Node node : document.getNodes("//Bucket/Name")) {
result.add(new S3Bucket(node.getTextContent()));
}
} else {
System.out.println("Unable to access to your S3 buckets : "
+ response.getStatus());