Tomcat tomcat = getTomcatInstance();
// Must have a real docBase - just use temp
File docBase = new File(System.getProperty("java.io.tmpdir"));
Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
TimeoutServlet timeout =
new TimeoutServlet(completeOnTimeout, dispatchUrl);
Wrapper wrapper = Tomcat.addServlet(ctx, "time", timeout);
wrapper.setAsyncSupported(true);
ctx.addServletMapping("/start", "time");
if (asyncDispatch != null) {
if (asyncDispatch.booleanValue()) {
AsyncStartRunnable asyncStartRunnable =
new AsyncStartRunnable();
Wrapper async =
Tomcat.addServlet(ctx, "async", asyncStartRunnable);
async.setAsyncSupported(true);
ctx.addServletMapping(dispatchUrl, "async");
} else {
NonAsyncServlet nonAsync = new NonAsyncServlet();
Tomcat.addServlet(ctx, "nonasync", nonAsync);
ctx.addServletMapping(dispatchUrl, "nonasync");
}
}
ctx.addApplicationListener(TrackingRequestListener.class.getName());
TesterAccessLogValve alv = new TesterAccessLogValve();
ctx.getPipeline().addValve(alv);
TesterAccessLogValve alvGlobal = new TesterAccessLogValve();
tomcat.getHost().getPipeline().addValve(alvGlobal);
tomcat.start();
try {