use of cn.taketoday.web.framework.config.DefaultServletConfiguration in project today-framework by TAKETODAY.
the class AbstractServletWebServer method addDefaultServlet.
/**
* Add default servlet
*/
protected void addDefaultServlet() {
DefaultServletConfiguration servletConfiguration = this.defaultServletConfiguration;
if (servletConfiguration != null) {
// config default servlet
getWebApplicationConfiguration().configureDefaultServlet(servletConfiguration);
if (servletConfiguration.isEnable()) {
Servlet defaultServlet = getDefaultServlet(servletConfiguration);
if (defaultServlet != null) {
log.info("Default servlet is enabled, use servlet: [{}]", defaultServlet.getServletInfo());
WebServletInitializer<Servlet> initializer = new WebServletInitializer<>(defaultServlet);
initializer.setName(Constant.DEFAULT);
initializer.setOrder(Ordered.HIGHEST_PRECEDENCE);
initializer.addUrlMappings(servletConfiguration.getUrlMappings());
initializer.setInitParameters(servletConfiguration.getInitParameters());
getContextInitializers().add(initializer);
}
}
}
}
Aggregations