use of org.jboss.as.web.common.ExpressionFactoryWrapper in project wildfly by wildfly.
the class JspInitializationListener method contextInitialized.
@Override
public void contextInitialized(final ServletContextEvent sce) {
// if the servlet version is 3.1 or higher, setup a ELResolver which allows usage of static fields java.lang.*
final ServletContext servletContext = sce.getServletContext();
final JspApplicationContext jspApplicationContext = JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
if (servletContext.getEffectiveMajorVersion() >= 3 && servletContext.getEffectiveMinorVersion() >= 1) {
jspApplicationContext.addELResolver(new ImportedClassELResolver());
}
// setup a wrapped JspApplicationContext if there are any EL expression factory wrappers for this servlet context
final List<ExpressionFactoryWrapper> expressionFactoryWrappers = (List<ExpressionFactoryWrapper>) sce.getServletContext().getAttribute(CONTEXT_KEY);
if (expressionFactoryWrappers != null && !expressionFactoryWrappers.isEmpty()) {
final JspApplicationContextWrapper jspApplicationContextWrapper = new JspApplicationContextWrapper(JspApplicationContextImpl.getInstance(servletContext), expressionFactoryWrappers, sce.getServletContext());
sce.getServletContext().setAttribute(JspApplicationContextImpl.class.getName(), jspApplicationContextWrapper);
}
}
Aggregations