Search in sources :

Example 6 with FilterHolder

use of org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder in project hbase by apache.

the class HttpServer method defineFilter.

/**
 * Define a filter for a context and set up default url mappings.
 */
public static void defineFilter(ServletContextHandler handler, String name, String classname, Map<String, String> parameters, String[] urls) {
    FilterHolder holder = new FilterHolder();
    holder.setName(name);
    holder.setClassName(classname);
    if (parameters != null) {
        holder.setInitParameters(parameters);
    }
    FilterMapping fmap = new FilterMapping();
    fmap.setPathSpecs(urls);
    fmap.setDispatches(FilterMapping.ALL);
    fmap.setFilterName(name);
    handler.getServletHandler().addFilter(holder, fmap);
}
Also used : FilterHolder(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder) FilterMapping(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping)

Example 7 with FilterHolder

use of org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder in project hbase by apache.

the class HttpServer method addInternalServlet.

/**
 * Add an internal servlet in the server, specifying whether or not to
 * protect with Kerberos authentication.
 * Note: This method is to be used for adding servlets that facilitate
 * internal communication and not for user facing functionality. For
 * servlets added using this method, filters (except internal Kerberos
 * filters) are not enabled.
 *
 * @param name The name of the servlet (can be passed as null)
 * @param pathSpec The path spec for the servlet
 * @param clazz The servlet class
 * @param requireAuth Require Kerberos authenticate to access servlet
 */
void addInternalServlet(String name, String pathSpec, Class<? extends HttpServlet> clazz, boolean requireAuthz) {
    ServletHolder holder = new ServletHolder(clazz);
    if (name != null) {
        holder.setName(name);
    }
    if (authenticationEnabled && requireAuthz) {
        FilterHolder filter = new FilterHolder(AdminAuthorizedFilter.class);
        filter.setName(AdminAuthorizedFilter.class.getSimpleName());
        FilterMapping fmap = new FilterMapping();
        fmap.setPathSpec(pathSpec);
        fmap.setDispatches(FilterMapping.ALL);
        fmap.setFilterName(AdminAuthorizedFilter.class.getSimpleName());
        webAppContext.getServletHandler().addFilter(filter, fmap);
    }
    webAppContext.getSessionHandler().getSessionCookieConfig().setHttpOnly(true);
    webAppContext.getSessionHandler().getSessionCookieConfig().setSecure(true);
    webAppContext.addServlet(holder, pathSpec);
}
Also used : FilterHolder(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder) ServletHolder(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder) FilterMapping(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping)

Aggregations

FilterHolder (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder)7 DispatcherType (javax.servlet.DispatcherType)3 FilterMapping (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping)2 ServletHolder (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder)2 ServletContainer (org.apache.hbase.thirdparty.org.glassfish.jersey.servlet.ServletContainer)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 ClickjackingPreventionFilter (org.apache.hadoop.hbase.http.ClickjackingPreventionFilter)1 InfoServer (org.apache.hadoop.hbase.http.InfoServer)1 SecurityHeadersFilter (org.apache.hadoop.hbase.http.SecurityHeadersFilter)1 AuthFilter (org.apache.hadoop.hbase.rest.filter.AuthFilter)1 GzipFilter (org.apache.hadoop.hbase.rest.filter.GzipFilter)1 RestCsrfPreventionFilter (org.apache.hadoop.hbase.rest.filter.RestCsrfPreventionFilter)1 Pair (org.apache.hadoop.hbase.util.Pair)1 MBeanContainer (org.apache.hbase.thirdparty.org.eclipse.jetty.jmx.MBeanContainer)1 HttpConfiguration (org.apache.hbase.thirdparty.org.eclipse.jetty.server.HttpConfiguration)1 HttpConnectionFactory (org.apache.hbase.thirdparty.org.eclipse.jetty.server.HttpConnectionFactory)1 SecureRequestCustomizer (org.apache.hbase.thirdparty.org.eclipse.jetty.server.SecureRequestCustomizer)1 Server (org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server)1 ServerConnector (org.apache.hbase.thirdparty.org.eclipse.jetty.server.ServerConnector)1 SslConnectionFactory (org.apache.hbase.thirdparty.org.eclipse.jetty.server.SslConnectionFactory)1