Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
REST service mixing data and representation
public class S3FilesResource {
AmazonS3Client amazonS3Client;
// ...
public String listS3Files() {
StringBuilder html = new StringBuilder("<html><body>");
List<S3ObjectSummary> files = this.amazonS3Client.listObjects("myBucket").getObjectSummaries();
for (S3ObjectSummary file : files) {
String filePath = file.getKey();
if (!filePath.endsWith("/")) { // exclude directories
html.append("<a href='/content?fileName=").append(filePath).append("'>").append(filePath)
return html.append("</body></html>").toString();
public String getContent(@QueryParam("fileName") String fileName) {
throw new UnsupportedOperationException("Not implemented yet");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.