File docBase = new File(System.getProperty("java.io.tmpdir"));
Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
TimeoutServlet timeout = new TimeoutServlet(null, null);
Wrapper w1 = Tomcat.addServlet(ctx, "time", timeout);
w1.setAsyncSupported(true);
ctx.addServletMapping("/async", "time");
NonAsyncServlet nonAsync = new NonAsyncServlet();
Wrapper w2 = Tomcat.addServlet(ctx, "nonAsync", nonAsync);
w2.setAsyncSupported(true);
ctx.addServletMapping("/error/nonasync", "nonAsync");
AsyncErrorPage asyncErrorPage = new AsyncErrorPage(mode);
Wrapper w3 = Tomcat.addServlet(ctx, "asyncErrorPage", asyncErrorPage);
w3.setAsyncSupported(true);
ctx.addServletMapping("/error/async", "asyncErrorPage");
if (asyncError != null) {
ErrorPage ep = new ErrorPage();
ep.setErrorCode(500);