context.setPath("");
context.addLifecycleListener(new ContextConfig());
context.setDocBase(pathInjector.getValue() + File.separatorChar + "welcome-content");
final Loader loader = new WebCtxLoader(this.getClass().getClassLoader());
Host host = hostInjector.getValue().getHost();
loader.setContainer(host);
context.setLoader(loader);
context.setInstanceManager(new LocalInstanceManager(httpManagement));
context.setReplaceWelcomeFiles(true);
if (httpManagement != null) {
context.addWelcomeFile("index.html");
} else {
context.addWelcomeFile("index_noconsole.html");
}
Wrapper wrapper = context.createWrapper();
wrapper.setName("default");
wrapper.setServletClass("org.apache.catalina.servlets.DefaultServlet");
context.addChild(wrapper);
context.addServletMapping("/", "default");
context.addMimeMapping("html", "text/html");
context.addMimeMapping("jpg", "image/jpeg");
// Add the WelcomeContextConsoleServlet
WelcomeContextConsoleServlet wccs = new WelcomeContextConsoleServlet(httpManagement);
Wrapper wccsWrapper = context.createWrapper();
wccsWrapper.setName("WelcomeContextConsoleServlet");
wccsWrapper.setServlet(wccs);
wccsWrapper.setServletClass(wccs.getClass().getName());
context.addChild(wccsWrapper);
context.addServletMapping("/console", "WelcomeContextConsoleServlet");
host.addChild(context);
context.create();
} catch (Exception e) {
throw new StartException(MESSAGES.createWelcomeContextFailed(), e);
}
try {