public class TestJspServlet extends TomcatBaseTest {
@Test
public void testBug56568a() throws Exception {
Tomcat tomcat = getTomcatInstance();
// Use the test web application so JSP support is available and the
// default JSP error page can be used.
File appDir = new File("test/webapp");
Context context = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
// Create a servlet that always throws an exception for a PUT request
Tomcat.addServlet(context, "Bug56568Servlet", new Bug56568aServlet());
context.addServletMapping("/bug56568", "Bug56568Servlet");
// Configure a JSP page to handle the 500 error response
// The JSP page will see the same method as the original request (PUT)
// PUT requests are normally blocked for JSPs
ErrorPage ep = new ErrorPage();
ep.setErrorCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
ep.setLocation("/WEB-INF/jsp/error.jsp");
context.addErrorPage(ep);
tomcat.start();
int rc = methodUrl("http://localhost:" + getPort() + "/test/bug56568",
new ByteChunk(), 5000, null, null, "PUT");
// Make sure we get the original 500 response and not a 405 response