in cdi-extension-el-jsp/src/main/java/org/apache/aries/cdi/extension/el/jsp/ELJSPExtension.java [62:101]
void afterDeploymentValidation(
@Observes @Priority(LIBRARY_AFTER + 800)
AfterDeploymentValidation adv, BeanManager beanManager) {
Dictionary<String, Object> properties = new Hashtable<>();
properties.put(SERVICE_DESCRIPTION, "Aries CDI - ELResolver Servlet Context Listener");
properties.put(SERVICE_VENDOR, "Apache Software Foundation");
properties.put(HTTP_WHITEBOARD_CONTEXT_SELECT, getSelectedContext());
properties.put(HTTP_WHITEBOARD_LISTENER, Boolean.TRUE.toString());
properties.put(SERVICE_RANKING, Integer.MAX_VALUE - 100);
_registration = _bundle.getBundleContext().registerService(
ServletContextListener.class,
new ServletContextListener() {
@Override
public void contextInitialized(ServletContextEvent event) {
ServletContext servletContext = event.getServletContext();
JspApplicationContext jspApplicationContext = JspFactory.getDefaultFactory().getJspApplicationContext(servletContext);
// Register the ELResolver with JSP
jspApplicationContext.addELResolver(beanManager.getELResolver());
// Register ELContextListener with JSP
try {
jspApplicationContext.addELContextListener(new WeldELContextListener());
}
catch (Exception e) {
servletContext.log("Failure registering ELContextListener", e);
}
}
@Override
public void contextDestroyed(ServletContextEvent event) {
// Nothing to do here
}
},
properties);
}