Search in sources :

Example 1 with FilterMapping

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

the class HttpServer method addFilterPathMapping.

/**
 * Add the path spec to the filter path mapping.
 * @param pathSpec The path spec
 * @param webAppCtx The WebApplicationContext to add to
 */
protected void addFilterPathMapping(String pathSpec, WebAppContext webAppCtx) {
    for (String name : filterNames) {
        FilterMapping fmap = new FilterMapping();
        fmap.setPathSpec(pathSpec);
        fmap.setFilterName(name);
        fmap.setDispatches(FilterMapping.ALL);
        webAppCtx.getServletHandler().addFilterMapping(fmap);
    }
}
Also used : FilterMapping(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping)

Example 2 with FilterMapping

use of org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping 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 3 with FilterMapping

use of org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping 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

FilterMapping (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterMapping)3 FilterHolder (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.FilterHolder)2 ServletHolder (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletHolder)1