@Test public void testBug49922() throws Exception { // Set up a container Tomcat tomcat = getTomcatInstance(); File root = new File("test/webapp-3.0"); tomcat.addWebapp("", root.getAbsolutePath()); tomcat.start(); ByteChunk result = new ByteChunk(); // Check filter and servlet aren't called int rc = getUrl("http://localhost:" + getPort() + "/bug49922/foo", result, null); assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); assertTrue(result.getLength() > 0); // Check extension mapping works result = getUrl("http://localhost:" + getPort() + "/foo.do"); assertEquals("FilterServlet", result.toString()); // Check path mapping works result = getUrl("http://localhost:" + getPort() + "/bug49922/servlet"); assertEquals("FilterServlet", result.toString()); // Check servlet name mapping works result = getUrl("http://localhost:" + getPort() + "/foo.od"); assertEquals("FilterServlet", result.toString()); // Check filter is only called once result = getUrl("http://localhost:" + getPort() + "/bug49922/servlet/foo.do"); assertEquals("FilterServlet", result.toString()); result = getUrl("http://localhost:" + getPort() + "/bug49922/servlet/foo.od"); assertEquals("FilterServlet", result.toString()); // Check dispatcher mapping result = getUrl("http://localhost:" + getPort() + "/bug49922/target"); assertEquals("Target", result.toString()); result = getUrl("http://localhost:" + getPort() + "/bug49922/forward"); assertEquals("FilterTarget", result.toString()); result = getUrl("http://localhost:" + getPort() + "/bug49922/include"); assertEquals("IncludeFilterTarget", result.toString()); }