public static void replaceInstanceManager(ServletContext context, WeldManager manager) { StandardContext stdContext = getStandardContext(context); setInstanceManager(stdContext, createInstance(manager, stdContext)); }
private static StandardContext getStandardContext(ServletContext context) { try { // Hack into Tomcat to replace the InstanceManager using // reflection to access private fields ApplicationContext appContext = (ApplicationContext) getContextFieldValue((ApplicationContextFacade) context, ApplicationContextFacade.class); return (StandardContext) getContextFieldValue(appContext, ApplicationContext.class); } catch (Exception e) { throw TomcatLogger.LOG.cannotGetStandardContext(e); } }
private static WeldForwardingInstanceManager createInstance(WeldManager manager, StandardContext stdContext) { try { InstanceManager weldProcessor = new WeldInstanceManager(manager); return new WeldForwardingInstanceManager(getInstanceManager(stdContext), weldProcessor); } catch (Exception e) { throw TomcatLogger.LOG.cannotCreatWeldForwardingAnnotationProcessor(e); } }
public void initialize(ContainerContext context) { try { WeldForwardingInstanceManager.replaceInstanceManager(context.getServletContext(), context.getManager()); if(Boolean.TRUE.equals(context.getServletContext().getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { TomcatLogger.LOG.allInjectionsAvailable(); } else { TomcatLogger.LOG.listenersInjectionsNotAvailable(); } } catch (Exception e) { TomcatLogger.LOG.unableToReplaceTomcat(e); } } }
private static WeldForwardingInstanceManager createInstance(WeldManager manager, StandardContext stdContext) { try { InstanceManager weldProcessor = new WeldInstanceManager(manager); return new WeldForwardingInstanceManager(getInstanceManager(stdContext), weldProcessor); } catch (Exception e) { throw TomcatLogger.LOG.cannotCreatWeldForwardingAnnotationProcessor(e); } }
public void initialize(ContainerContext context) { try { WeldForwardingInstanceManager.replaceInstanceManager(context.getServletContext(), context.getManager()); if(Boolean.TRUE.equals(context.getServletContext().getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { TomcatLogger.LOG.allInjectionsAvailable(); } else { TomcatLogger.LOG.listenersInjectionsNotAvailable(); } } catch (Exception e) { TomcatLogger.LOG.unableToReplaceTomcat(e); } } }
public static void replaceInstanceManager(ServletContext context, WeldManager manager) { StandardContext stdContext = getStandardContext(context); setInstanceManager(stdContext, createInstance(manager, stdContext)); }
private static WeldForwardingInstanceManager createInstance(WeldManager manager, StandardContext stdContext) { try { InstanceManager weldProcessor = new WeldInstanceManager(manager); return new WeldForwardingInstanceManager(getInstanceManager(stdContext), weldProcessor); } catch (Exception e) { throw TomcatLogger.LOG.cannotCreatWeldForwardingAnnotationProcessor(e); } }
private static StandardContext getStandardContext(ServletContext context) { try { // Hack into Tomcat to replace the InstanceManager using // reflection to access private fields ApplicationContext appContext = (ApplicationContext) getContextFieldValue((ApplicationContextFacade) context, ApplicationContextFacade.class); return (StandardContext) getContextFieldValue(appContext, ApplicationContext.class); } catch (Exception e) { throw TomcatLogger.LOG.cannotGetStandardContext(e); } }
public void initialize(ContainerContext context) { try { WeldForwardingInstanceManager.replaceInstanceManager(context.getServletContext(), context.getManager()); if(Boolean.TRUE.equals(context.getServletContext().getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { TomcatLogger.LOG.allInjectionsAvailable(); } else { TomcatLogger.LOG.listenersInjectionsNotAvailable(); } } catch (Exception e) { TomcatLogger.LOG.unableToReplaceTomcat(e); } } }
public static void replaceInstanceManager(ServletContext context, WeldManager manager) { StandardContext stdContext = getStandardContext(context); setInstanceManager(stdContext, createInstance(manager, stdContext)); }
private static StandardContext getStandardContext(ServletContext context) { try { // Hack into Tomcat to replace the InstanceManager using // reflection to access private fields ApplicationContext appContext = (ApplicationContext) getContextFieldValue((ApplicationContextFacade) context, ApplicationContextFacade.class); return (StandardContext) getContextFieldValue(appContext, ApplicationContext.class); } catch (Exception e) { throw TomcatLogger.LOG.cannotGetStandardContext(e); } }