use of cn.taketoday.web.framework.config.WebDocumentConfiguration in project today-framework by TAKETODAY.
the class TomcatServer method doPrepareContext.
protected void doPrepareContext(Host host) {
try {
//
ServletWebServerApplicationLoader starter = new ServletWebServerApplicationLoader(obtainApplicationContext(), this::getMergedInitializers);
TomcatEmbeddedContext context = new TomcatEmbeddedContext(sessionIdGenerator);
context.setFailCtxIfServletStartFails(true);
context.setName(getContextPath());
context.setDisplayName(getDisplayName());
context.setPath(getContextPath());
WebDocumentConfiguration webDocumentConfiguration = getWebDocumentConfiguration();
if (webDocumentConfiguration != null) {
Resource validDocBase = webDocumentConfiguration.getValidDocumentDirectory();
if (validDocBase != null && validDocBase.exists() && validDocBase.isDirectory()) {
context.setDocBase(validDocBase.getFile().getAbsolutePath());
}
}
context.addLifecycleListener(new FixContextListener());
context.setParentClassLoader(ClassUtils.getDefaultClassLoader());
resetDefaultLocaleMapping(context);
addLocaleMappings(context);
context.setUseRelativeRedirects(useRelativeRedirects);
WebappLoader loader = new WebappLoader();
loader.setLoaderClass(WebappClassLoader.class.getName());
loader.setDelegate(true);
context.setLoader(loader);
configureJasperInitializer(context);
host.addChild(context);
context.addServletContainerInitializer(starter, Collections.emptySet());
configureTomcatContext(context);
} catch (IOException e) {
throw new ConfigurationException(e);
}
}
Aggregations