@Override public Object contextEntered(final WebBeansContext newOWBContext) { return enter(newOWBContext); }
@Override public void contextExited(final Object oldContext) { exit(oldContext); }
private WebBeansContext getContext(final ClassLoader cl) { return get(cl); }
@Override public ELResolver getOwbELResolver() { WebBeansContext old = null; boolean exit = false; try { // just some safety around this but should be very very rare WebBeansContext.currentInstance(); } catch (final IllegalStateException ise) { old = ThreadSingletonServiceImpl.enter(appContext.getWebBeansContext()); exit = true; } try { return new WebBeansELResolver(); } finally { if (exit) { ThreadSingletonServiceImpl.exit(old); } } }
appContext.setCdiEnabled(hasBeans(startupObject.getAppInfo())); if (sessionContextClass() != null && tomee) { properties.setProperty("org.apache.webbeans.proxy.mapping.javax.enterprise.context.SessionScoped", "org.apache.tomee.catalina.cdi.SessionNormalScopeBeanHandler"); optional(services, ConversationService.class, "org.apache.webbeans.jsf.DefaultConversationService"); services.put(ResourceInjectionService.class, new CdiResourceInjectionService(webBeansContext)); old = contextEntered(webBeansContext); setConfiguration(webBeansContext.getOpenWebBeansConfiguration()); try { webBeansContext.getService(ContainerLifecycle.class).startApplication(startupObject); contextExited(old); Thread.currentThread().setContextClassLoader(oldClassLoader);
appContext.setCdiEnabled(hasBeans(startupObject.getAppInfo())); old = contextEntered(webBeansContext); setConfiguration(webBeansContext.getOpenWebBeansConfiguration()); try { webBeansContext.getService(ContainerLifecycle.class).startApplication(startupObject); contextExited(old); Thread.currentThread().setContextClassLoader(oldClassLoader);
@Override public WebBeansContext get(final Object key) { return getContext((ClassLoader) key); }
@Override public WebBeansContext get(final Object key) { return getContext((ClassLoader) key); }
@Override public Object contextEntered(final WebBeansContext newOWBContext) { return enter(newOWBContext); }
@Override public void contextExited(final Object oldContext) { exit(oldContext); }
@Override public void clear(final Object key) { final WebBeansContext ctx = getContext((ClassLoader) key); if (logger.isDebugEnabled()) { logger.debug("Clearing:'" + ctx + "'"); } contextByClassLoader.remove(key); ctx.clear(); }
private WebBeansContext getContext(final ClassLoader cl) { return get(cl); }
/** * {@inheritDoc} */ public void requestInitialized(ServletRequestEvent event) { final Object oldContext = ThreadSingletonServiceImpl.enter(this.webBeansContext); event.getServletRequest().setAttribute(contextKey, oldContext); try { if (logger.wblWillLogDebug()) { logger.debug("Starting a new request : [{0}]", event.getServletRequest().getRemoteAddr()); } this.webBeansContext.getContextsService().startContext(RequestScoped.class, event); // we don't initialise the Session here but do it lazily if it gets requested // the first time. See OWB-457 } catch (Exception e) { logger.error(OWBLogConst.ERROR_0019, event.getServletRequest()); WebBeansUtil.throwRuntimeExceptions(e); } }
ThreadSingletonServiceImpl.exit(null); if (assembler != null) { assembler.destroy();
@Override public void clear(final Object key) { final WebBeansContext ctx = getContext((ClassLoader) key); if (logger.isDebugEnabled()) { logger.debug("Clearing:'" + ctx + "'"); } contextByClassLoader.remove(key); if (ctx != null) { ctx.clear(); } } }
cleanupRequestThreadLocals(); } finally { ThreadSingletonServiceImpl.enter((WebBeansContext) oldContext);
ThreadSingletonServiceImpl.exit(null); if (assembler != null) { assembler.destroy();
/** * {@inheritDoc} */ @Override public void requestInitialized(final ServletRequestEvent event) { final Object oldContext = ThreadSingletonServiceImpl.enter(this.webBeansContext); if (event != null) { event.getServletRequest().setAttribute(contextKey, oldContext); } try { if (logger.isDebugEnabled()) { logger.debug("Starting a new request : [{0}]", event == null ? "null" : event.getServletRequest().getRemoteAddr()); } if (webBeansContext instanceof WebappWebBeansContext) { // start before child ((WebappWebBeansContext) webBeansContext).getParent().getContextsService().startContext(RequestScoped.class, event); } contextsService.startContext(RequestScoped.class, event); // we don't initialise the Session here but do it lazily if it gets requested // the first time. See OWB-457 } catch (final Exception e) { logger.error(OWBLogConst.ERROR_0019, event == null ? "null" : event.getServletRequest()); WebBeansUtil.throwRuntimeExceptions(e); } }
/** * {@inheritDoc} */ @Override public void requestInitialized(final ServletRequestEvent event) { final Object oldContext = ThreadSingletonServiceImpl.enter(this.webBeansContext); if (event != null) { event.getServletRequest().setAttribute(contextKey, oldContext); } try { if (logger.isDebugEnabled()) { logger.debug("Starting a new request : [{0}]", event == null ? "null" : event.getServletRequest().getRemoteAddr()); } if (webBeansContext instanceof WebappWebBeansContext) { // start before child ((WebappWebBeansContext) webBeansContext).getParent().getContextsService().startContext(RequestScoped.class, event); } this.webBeansContext.getContextsService().startContext(RequestScoped.class, event); // we don't initialise the Session here but do it lazily if it gets requested // the first time. See OWB-457 } catch (final Exception e) { logger.error(OWBLogConst.ERROR_0019, event == null ? "null" : event.getServletRequest()); WebBeansUtil.throwRuntimeExceptions(e); } }
ThreadSingletonServiceImpl.enter((WebBeansContext) oldContext);