Package org.apache.tomcat

Examples of org.apache.tomcat.InstanceManager


    }

    public void destroy() {
        if (theServlet != null) {
            theServlet.destroy();
            InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config);
            try {
                instanceManager.destroyInstance(theServlet);
            } catch (Exception e) {
                // Log any exception, since it can't be passed along
                log.error(Localizer.getMessage("jsp.error.file.not.found",
                        e.getMessage()), e);
            }
View Full Code Here


    private InstanceManagerFactory() {
    }

    public static InstanceManager getInstanceManager(ServletConfig config) {
        InstanceManager instanceManager =
                (InstanceManager) config.getServletContext().getAttribute(InstanceManager.class.getName());
        if (instanceManager == null) {
            throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
        }
        return instanceManager;
View Full Code Here

    }

    @Override
    public void preDestroy(Object instance, Object creationMetaData) throws InjectionProviderException
    {
        InstanceManager manager = instanceManagers
                .get(ClassUtils.getContextClassLoader());

        if (manager != null)
        {
            try
            {
                manager.destroyInstance(instance);
            }
            catch (IllegalAccessException ex)
            {
                throw new InjectionProviderException(ex);
            }
View Full Code Here

    }

    @Override
    public void postConstruct(Object instance, Object creationMetaData) throws InjectionProviderException
    {
        InstanceManager manager = instanceManagers
                .get(ClassUtils.getContextClassLoader());
        if (manager == null)
        {
            //Initialize manager
            manager = initManager();
        }

        //Is initialized
        if (manager != null)
        {
            //Inject resources
            try
            {
                manager.newInstance(instance);
            }
            catch (IllegalAccessException ex)
            {
                throw new InjectionProviderException(ex);
            }
View Full Code Here

                if (ExternalSpecifications.isCDIAvailable(facesContext.getExternalContext()))
                {
                   
                    ExternalContext extCtx = facesContext.getExternalContext();
                    Map<String, Object> applicationMap = extCtx.getApplicationMap();
                    InstanceManager instanceManager = (InstanceManager)
                            applicationMap.get(InstanceManager.class.getName());                   
                   
                    Class clazz = ClassUtils.classForName(
                        "org.apache.myfaces.cdi.checkenv.DummyInjectableBean");
                    Object dummyInjectableBean = clazz.newInstance();
                    instanceManager.newInstance(dummyInjectableBean);
                   
                    Method m = clazz.getDeclaredMethod("isDummyBeanInjected");
                    Object value = m.invoke(dummyInjectableBean);
                    if (Boolean.TRUE.equals(value))
                    {
View Full Code Here

        }

        // get application map to access ServletContext attributes
        Map<String, Object> applicationMap = extCtx.getApplicationMap();

        InstanceManager instanceManager = (InstanceManager)
                applicationMap.get(InstanceManager.class.getName());
        if (instanceManager != null)
        {
            instanceManagers.put(ClassUtils.getContextClassLoader(),
                    instanceManager);
View Full Code Here

    private InstanceManagerFactory() {
    }

    public static InstanceManager getInstanceManager(ServletConfig config) {
        InstanceManager instanceManager =
                (InstanceManager) config.getServletContext().getAttribute(InstanceManager.class.getName());
        if (instanceManager == null) {
            throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
        }
        return instanceManager;
View Full Code Here

                unavailable(null);
                throw new ServletException
                    (sm.getString("standardWrapper.notClass", getName()));
            }

            InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager();
            try {
                servlet = (Servlet) instanceManager.newInstance(servletClass);
            } catch (ClassCastException e) {
                unavailable(null);
                // Restore the context ClassLoader
                throw new ServletException
                    (sm.getString("standardWrapper.notServlet", servletClass), e);
View Full Code Here

        if (context.getInstanceManager() instanceof TomcatInstanceManager)
        {
            return;
        }

        InstanceManager processor = context.getInstanceManager();
        InstanceManager custom = new TomcatInstanceManager(context.getLoader().getClassLoader(), processor);
        context.setInstanceManager(custom);

        context.getServletContext().setAttribute(InstanceManager.class.getName(), custom);
    }
View Full Code Here

                unavailable(null);
                throw new ServletException
                    (sm.getString("standardWrapper.notClass", getName()));
            }

            InstanceManager instanceManager = ((StandardContext)getParent()).getInstanceManager();
            try {
                servlet = (Servlet) instanceManager.newInstance(servletClass);
            } catch (ClassCastException e) {
                unavailable(null);
                // Restore the context ClassLoader
                throw new ServletException
                    (sm.getString("standardWrapper.notServlet", servletClass), e);
View Full Code Here

TOP

Related Classes of org.apache.tomcat.InstanceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.