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
This commit is contained in:
Michael Stack 2014-02-05 21:11:30 +00:00
parent 976ea775ae
commit 3b05134e0d
3 changed files with 5 additions and 3 deletions

View File

@ -35,9 +35,8 @@ import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.rest.filter.AuthFilter; 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.security.UserProvider;
import org.apache.hadoop.hbase.util.HttpServerUtil;
import org.apache.hadoop.hbase.util.InfoServer; import org.apache.hadoop.hbase.util.InfoServer;
import org.apache.hadoop.hbase.util.Strings; import org.apache.hadoop.hbase.util.Strings;
import org.apache.hadoop.hbase.util.VersionInfo; import org.apache.hadoop.hbase.util.VersionInfo;
@ -235,6 +234,7 @@ public class RESTServer implements Constants {
filter = filter.trim(); filter = filter.trim();
context.addFilter(Class.forName(filter), "/*", 0); context.addFilter(Class.forName(filter), "/*", 0);
} }
HttpServerUtil.constrainHttpMethods(context);
// Put up info server. // Put up info server.
int port = conf.getInt("hbase.rest.info.port", 8085); int port = conf.getInt("hbase.rest.info.port", 8085);

View File

@ -89,6 +89,7 @@ public class InfoServer extends HttpServer {
logsContextPath); logsContextPath);
logContext.setResourceBase(logDir); logContext.setResourceBase(logDir);
logContext.addServlet(DefaultServlet.class, "/"); logContext.addServlet(DefaultServlet.class, "/");
HttpServerUtil.constrainHttpMethods(logContext);
defaultContexts.put(logContext, true); defaultContexts.put(logContext, true);
} }
} }

View File

@ -22,8 +22,8 @@ import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; 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.security.User;
import org.apache.hadoop.hbase.util.HttpServerUtil;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
import org.mortbay.jetty.Server; import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context; import org.mortbay.jetty.servlet.Context;
@ -75,6 +75,7 @@ public class HBaseRESTTestingUtility {
filter = filter.trim(); filter = filter.trim();
context.addFilter(Class.forName(filter), "/*", 0); context.addFilter(Class.forName(filter), "/*", 0);
} }
HttpServerUtil.constrainHttpMethods(context);
LOG.info("Loaded filter classes :" + filterClasses); LOG.info("Loaded filter classes :" + filterClasses);
// start the server // start the server
server.start(); server.start();