You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2022/03/25 14:23:32 UTC

[ozone] branch master updated: HDDS-6497. S3 Gateway throws exception when checking jmx or prom pages from browser (#3228)

This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 6057466  HDDS-6497. S3 Gateway throws exception when checking jmx or prom pages from browser (#3228)
6057466 is described below

commit 605746617bf22929ec690c01c0820df8b7dfcdfd
Author: Symious <yi...@foxmail.com>
AuthorDate: Fri Mar 25 22:23:09 2022 +0800

    HDDS-6497. S3 Gateway throws exception when checking jmx or prom pages from browser (#3228)
---
 .../apache/hadoop/hdds/server/http/HttpServer2.java   |  1 +
 .../apache/hadoop/ozone/s3/S3GatewayHttpServer.java   | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
index 4cb794a..90c0709 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java
@@ -1516,6 +1516,7 @@ public final class HttpServer2 implements FilterContainer {
     return adminsAcl != null && adminsAcl.isUserAllowed(remoteUserUGI);
   }
 
+
   /**
    * A very simple servlet to serve up a text representation of the current
    * stack traces. It both returns the stacks to the caller and logs them.
diff --git a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/S3GatewayHttpServer.java b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/S3GatewayHttpServer.java
index 3bb10d3..9ff9445 100644
--- a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/S3GatewayHttpServer.java
+++ b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/S3GatewayHttpServer.java
@@ -22,6 +22,11 @@ import java.io.IOException;
 import org.apache.hadoop.hdds.conf.MutableConfigurationSource;
 import org.apache.hadoop.hdds.server.http.BaseHttpServer;
 
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 /**
  * S3 Gateway specific configuration keys.
  */
@@ -35,6 +40,7 @@ public class S3GatewayHttpServer extends BaseHttpServer {
   public S3GatewayHttpServer(MutableConfigurationSource conf,
       String name) throws IOException {
     super(conf, name);
+    addServlet("icon", "/favicon.ico", IconServlet.class);
   }
 
   @Override
@@ -97,4 +103,17 @@ public class S3GatewayHttpServer extends BaseHttpServer {
     return S3GatewayConfigKeys.OZONE_S3G_HTTP_AUTH_CONFIG_PREFIX;
   }
 
+  /**
+   * Servlet for favicon.ico.
+   */
+  public static class IconServlet extends HttpServlet {
+    private static final long serialVersionUID = -1L;
+
+    @Override
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException {
+      response.setContentType("image/png");
+      response.sendRedirect("/static/images/ozone.ico");
+    }
+  }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org