use of javax.servlet.jsp.JspApplicationContext in project wildfly by wildfly.
the class WeldJspExpressionFactoryWrapper method wrap.
@Override
public ExpressionFactory wrap(ExpressionFactory expressionFactory, ServletContext servletContext) {
BeanManager beanManager = getBeanManager();
if (beanManager == null) {
// this should never happen
return expressionFactory;
}
// get JspApplicationContext.
JspApplicationContext jspAppContext = JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
// register compositeELResolver with Jakarta Server Pages
jspAppContext.addELResolver(beanManager.getELResolver());
jspAppContext.addELContextListener(Reflections.<ELContextListener>newInstance("org.jboss.weld.module.web.el.WeldELContextListener", getClass().getClassLoader()));
return beanManager.wrapExpressionFactory(expressionFactory);
}
use of javax.servlet.jsp.JspApplicationContext in project Payara by payara.
the class WeldContextListener method contextInitialized.
/**
* Stash the Weld EL Resolver and Weld EL Context Listener so it is recognized by JSP.
* @param servletContextEvent
*/
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
if (beanManager != null) {
JspApplicationContext jspAppContext = getJspApplicationContext(servletContextEvent);
jspAppContext.addELResolver(beanManager.getELResolver());
try {
Class<?> weldClass = Class.forName("org.jboss.weld.module.web.el.WeldELContextListener");
WeldELContextListener welcl = (WeldELContextListener) weldClass.newInstance();
jspAppContext.addELContextListener(welcl);
} catch (Exception e) {
logger.log(Level.WARNING, CDILoggerInfo.CDI_COULD_NOT_CREATE_WELDELCONTEXTlISTENER, new Object[] { e });
}
((JspApplicationContextImpl) jspAppContext).setExpressionFactory(beanManager.wrapExpressionFactory(jspAppContext.getExpressionFactory()));
}
}
use of javax.servlet.jsp.JspApplicationContext in project jfinal by jfinal.
the class ModelRecordElResolver method init.
public static synchronized void init(ServletContext servletContext) {
JspApplicationContext jac = JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
if (jspApplicationContext != jac) {
jspApplicationContext = jac;
jspApplicationContext.addELResolver(new ModelRecordElResolver());
}
}
Aggregations