use of cn.taketoday.web.framework.config.JspServletConfiguration in project today-framework by TAKETODAY.
the class AbstractServletWebServer method addJspServlet.
/**
* Add jsp to context
*/
protected void addJspServlet() {
JspServletConfiguration jspServletConfiguration = this.jspServletConfiguration;
if (jspServletConfiguration != null) {
// config jsp servlet
getWebApplicationConfiguration().configureJspServlet(jspServletConfiguration);
if (jspServletConfiguration.isEnabled()) {
try {
Servlet jspServlet = BeanUtils.newInstance(jspServletConfiguration.getClassName());
log.info("Jsp is enabled, use jsp servlet: [{}]", jspServlet.getServletInfo());
WebServletInitializer<Servlet> initializer = new WebServletInitializer<>(jspServlet);
initializer.setName(jspServletConfiguration.getName());
initializer.setOrder(Ordered.HIGHEST_PRECEDENCE);
initializer.addUrlMappings(jspServletConfiguration.getUrlMappings());
initializer.setInitParameters(jspServletConfiguration.getInitParameters());
getContextInitializers().add(initializer);
} catch (ClassNotFoundException e) {
throw new ConfigurationException("jsp servlet class not found", e);
}
}
}
}
Aggregations