From 3b05134e0d8c1c47022b11cca37d5a3f1822ab6c Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 5 Feb 2014 21:11:30 +0000 Subject: [PATCH] HBASE-10473 Add utility for adorning http Context git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1564927 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/hadoop/hbase/rest/RESTServer.java | 4 ++-- .../main/java/org/apache/hadoop/hbase/util/InfoServer.java | 1 + .../org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java index 8039e102bb9..d2c4e9d1186 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java @@ -35,9 +35,8 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.rest.filter.AuthFilter; -import org.apache.hadoop.hbase.rest.filter.GzipFilter; -import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.security.UserProvider; +import org.apache.hadoop.hbase.util.HttpServerUtil; import org.apache.hadoop.hbase.util.InfoServer; import org.apache.hadoop.hbase.util.Strings; import org.apache.hadoop.hbase.util.VersionInfo; @@ -235,6 +234,7 @@ public class RESTServer implements Constants { filter = filter.trim(); context.addFilter(Class.forName(filter), "/*", 0); } + HttpServerUtil.constrainHttpMethods(context); // Put up info server. int port = conf.getInt("hbase.rest.info.port", 8085); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java index edbb0ca7399..8c558acf933 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java @@ -89,6 +89,7 @@ public class InfoServer extends HttpServer { logsContextPath); logContext.setResourceBase(logDir); logContext.addServlet(DefaultServlet.class, "/"); + HttpServerUtil.constrainHttpMethods(logContext); defaultContexts.put(logContext, true); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java index 8c316dd35ab..1353090c0a9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/HBaseRESTTestingUtility.java @@ -22,8 +22,8 @@ import org.apache.commons.lang.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.rest.filter.GzipFilter; import org.apache.hadoop.hbase.security.User; +import org.apache.hadoop.hbase.util.HttpServerUtil; import org.apache.hadoop.util.StringUtils; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.Context; @@ -75,6 +75,7 @@ public class HBaseRESTTestingUtility { filter = filter.trim(); context.addFilter(Class.forName(filter), "/*", 0); } + HttpServerUtil.constrainHttpMethods(context); LOG.info("Loaded filter classes :" + filterClasses); // start the server server.start();