public void testBasicFilterMappings() throws IOException, ServletException {
DeploymentInfo builder = new DeploymentInfo();
final PathHandler root = new PathHandler();
final ServletContainer container = ServletContainer.Factory.newInstance();
builder.addServlet(new ServletInfo("/a/*", PathMappingServlet.class)
.addMapping("/a/*"));
builder.addServlet(new ServletInfo("/aa", PathMappingServlet.class)
.addMapping("/aa"));
builder.addServlet(new ServletInfo("/", PathMappingServlet.class)
.addMapping("/"));
builder.addServlet(new ServletInfo("contextRoot", PathMappingServlet.class)
.addMapping(""));
builder.addServlet(new ServletInfo("/myservlet/*", PathMappingServlet.class)
.addMapping("/myservlet/*"));
builder.addServlet(new ServletInfo("*.jsp", PathMappingServlet.class)
.addMapping("*.jsp"));
builder.addFilter(new FilterInfo("/*", PathFilter.class));
builder.addFilterUrlMapping("/*", "/*", DispatcherType.REQUEST);
//non standard, but we still support it
builder.addFilter(new FilterInfo("*", PathFilter.class));
builder.addFilterUrlMapping("*", "*", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("/a/*", PathFilter.class));
builder.addFilterUrlMapping("/a/*", "/a/*", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("/aa", PathFilter.class));
builder.addFilterUrlMapping("/aa", "/aa", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("*.bop", PathFilter.class));
builder.addFilterUrlMapping("*.bop", "*.bop", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("/myservlet/myfilter/*", PathFilter.class));
builder.addFilterUrlMapping("/myservlet/myfilter/*", "/myservlet/myfilter/*", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("/myfilter/*", PathFilter.class));
builder.addFilterUrlMapping("/myfilter/*", "/myfilter/*", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("contextRoot", PathFilter.class));
builder.addFilterServletNameMapping("contextRoot", "contextRoot", DispatcherType.REQUEST);
builder.addFilter(new FilterInfo("defaultName", PathFilter.class));
builder.addFilterServletNameMapping("defaultName", "/", DispatcherType.REQUEST);
builder.setClassIntrospecter(TestClassIntrospector.INSTANCE)
.setClassLoader(FilterPathMappingTestCase.class.getClassLoader())
.setContextPath("/servletContext")
.setDeploymentName("servletContext.war");
final DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
root.addPrefixPath(builder.getContextPath(), manager.start());
DefaultServer.setRootHandler(root);