diff --git a/NOTICE.txt b/NOTICE.txt index a53f13c700..00fa3758ee 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -613,3 +613,11 @@ which has the following notices: Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and released to the public domain, as explained at http://creativecommons.org/publicdomain/zero/1.0/ + + +The source and binary distribution of this product bundles modified version of + github.com/awslabs/aws-js-s3-explorer licensed under Apache 2.0 license + with the following notice: + +AWS JavaScript S3 Explorer +Copyright 2014-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. \ No newline at end of file diff --git a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java index 7a7c92d261..1fa19c422f 100644 --- a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java +++ b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketEndpoint.java @@ -27,9 +27,11 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import java.io.IOException; +import java.io.InputStream; import java.time.Instant; import java.util.Iterator; @@ -60,15 +62,25 @@ public class BucketEndpoint extends EndpointBase { * for more details. */ @GET - public ListObjectResponse list( + public Response list( @PathParam("bucket") String bucketName, @QueryParam("delimiter") String delimiter, @QueryParam("encoding-type") String encodingType, @QueryParam("marker") String marker, @DefaultValue("1000") @QueryParam("max-keys") int maxKeys, @QueryParam("prefix") String prefix, + @QueryParam("browser") String browser, @Context HttpHeaders hh) throws OS3Exception, IOException { + if (browser != null) { + try (InputStream browserPage = getClass() + .getResourceAsStream("/browser.html")) { + return Response.ok(browserPage, + MediaType.TEXT_HTML_TYPE) + .build(); + } + } + if (delimiter == null) { delimiter = "/"; } @@ -125,7 +137,7 @@ public ListObjectResponse list( } response.setKeyCount( response.getCommonPrefixes().size() + response.getContents().size()); - return response; + return Response.ok(response).build(); } @PUT diff --git a/hadoop-ozone/s3gateway/src/main/resources/browser.html b/hadoop-ozone/s3gateway/src/main/resources/browser.html new file mode 100644 index 0000000000..dc05a00177 --- /dev/null +++ b/hadoop-ozone/s3gateway/src/main/resources/browser.html @@ -0,0 +1,617 @@ + + + + + + + + AWS S3 Explorer + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+
+ Ozone S3 Explorer  +
+ +
+ +
+
+ +
+
+ + +
+ + +
+
+ +
+ + 42 +
+
+
+ + +
+ + + + + + + + + + + +
ObjectFolderLast ModifiedTimestampSize
+
+
+
+
+
+ + + + + + + + + + + + + diff --git a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketGet.java b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketGet.java index 41778b2a2a..54534edc93 100644 --- a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketGet.java +++ b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestBucketGet.java @@ -44,7 +44,9 @@ public void listRoot() throws OS3Exception, IOException { getBucket.setClient(client); ListObjectResponse getBucketResponse = - getBucket.list("b1", "/", null, null, 100, "", null); + (ListObjectResponse) getBucket + .list("b1", "/", null, null, 100, "", null, null) + .getEntity(); Assert.assertEquals(1, getBucketResponse.getCommonPrefixes().size()); Assert.assertEquals("dir1/", @@ -66,7 +68,8 @@ public void listDir() throws OS3Exception, IOException { getBucket.setClient(client); ListObjectResponse getBucketResponse = - getBucket.list("b1", "/", null, null, 100, "dir1", null); + (ListObjectResponse) getBucket + .list("b1", "/", null, null, 100, "dir1", null, null).getEntity(); Assert.assertEquals(1, getBucketResponse.getCommonPrefixes().size()); Assert.assertEquals("dir1/", @@ -87,7 +90,8 @@ public void listSubDir() throws OS3Exception, IOException { getBucket.setClient(ozoneClient); ListObjectResponse getBucketResponse = - getBucket.list("b1", "/", null, null, 100, "dir1/", null); + (ListObjectResponse) getBucket + .list("b1", "/", null, null, 100, "dir1/", null, null).getEntity(); Assert.assertEquals(1, getBucketResponse.getCommonPrefixes().size()); Assert.assertEquals("dir1/dir2/",