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);
  }
Define a filter for a context and set up default url mappings.
hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java