Beispiel #1
0
        public static void InitRuntime(ServletConfig config, object evidence)
        {
            ServletContext context = config.getServletContext();

            if (context.getAttribute(J2EEConsts.APP_DOMAIN) != null)
            {
                return;
            }

            _facesContextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
            //TODO: null-check for Weblogic, that tries to initialize Servlet before ContextListener

            //Javadoc says: Lifecycle instance is shared across multiple simultaneous requests, it must be implemented in a thread-safe manner.
            //So we can acquire it here once:
            LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);

            _lifecycle = lifecycleFactory.getLifecycle(context.getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR) ?? LifecycleFactory.DEFAULT_LIFECYCLE);

            _renderKitFactory = (RenderKitFactory)FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);

            AppDomain servletDomain = createServletDomain(config);

            [email protected](servletDomain);

            try {
                //GH Infromation Initizalization
                long currentTime = java.lang.System.currentTimeMillis();
                servletDomain.SetData(".domainId", currentTime.ToString("x"));
                currentTime = ~currentTime;
                servletDomain.SetData(".appId", currentTime.ToString("x"));
                servletDomain.SetData(".appName", servletDomain.SetupInformation.ApplicationName);

                servletDomain.SetData(J2EEConsts.CLASS_LOADER, java.lang.Thread.currentThread().getContextClassLoader());
                //servletDomain.SetData (J2EEConsts.CLASS_LOADER, vmw.common.TypeUtils.ToClass (evidence).getClassLoader ());
                //servletDomain.SetData(J2EEConsts.SERVLET_CONFIG, config);
                servletDomain.SetData(J2EEConsts.RESOURCE_LOADER, new ServletResourceLoader(context));

                lock (evidence) {
                    if (context.getAttribute(J2EEConsts.APP_DOMAIN) == null)
                    {
                        context.setAttribute(J2EEConsts.APP_DOMAIN, servletDomain);
                    }
                }
                //config.getServletContext ().setAttribute (J2EEConsts.CURRENT_SERVLET, this);
            }
            finally {
                [email protected]();
                [email protected]();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Implentation to resolve an object with the <see cref="InfuseContainer"/>
        /// </summary>
        /// <typeparam name="TInterface">Contract to TImplementation that needs to be resolved</typeparam>
        /// <returns>Implementation of the interface</returns>
        public TInterface Resolve <TInterface>()
        {
            var lifecycleInstance = LifecycleFactory.GetLifecycleInstance <TInterface>(_registrar);

            return(lifecycleInstance.Resolve <TInterface>());
        }