void contextInitialized(ServletContext context) { final ClassLoader cl = getContextClassLoader(); if (cl != null) { servletContexts.put(cl, context); } }
@Override protected ServletContext newInstance(InjectionPoint ip, CreationalContext<ServletContext> creationalContext) { final ServletContext ctx = servletContexts.getCurrentServletContext(); if (ctx == null) { final ClassLoader cl = AccessController.doPrivileged(GetContextClassLoaderAction.INSTANCE); throw ServletLogger.LOG.cannotInjectServletContext(cl, servletContexts); } return ctx; }
public void contextInitialized(ServletContext ctx) { servletContextService.contextInitialized(ctx); fireEventForApplicationScope(ctx, InitializedLiteral.APPLICATION); }
services.add(ServletContextService.class, new ServletContextService()); services.add(ProtectionDomainCache.class, new ProtectionDomainCache());
/** * Obtains the {@link ServletContext} associated with this request. * @return the ServletContext associated with this request or null if there is no such association */ public ServletContext getCurrentServletContext() { final ClassLoader cl = getContextClassLoader(); if (cl == null) { return null; } return servletContexts.get(cl); }