Package org.apache.tomcat

Examples of org.apache.tomcat.InstanceManager


                    destroy();
                   
                    final Servlet servlet;

                    try {
                        InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config);
                        servlet = (Servlet) instanceManager.newInstance(ctxt.getFQCN(), ctxt.getJspLoader());
                    } catch (IllegalAccessException e) {
                        throw new JasperException(e);
                    } catch (InstantiationException e) {
                        throw new JasperException(e);
                    } catch (Exception e) {
View Full Code Here


    }

    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

                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

        this.instanceManagers = instanceManagers;
    }

    @Override
    public <T> T getEndpointInstance(final Class<T> clazz) throws InstantiationException {
        final InstanceManager instanceManager = instanceManagers.get(clazz.getClassLoader());
        if (instanceManager == null) {
            return super.getEndpointInstance(clazz);
        }

        try {
            return clazz.cast(instanceManager.newInstance(clazz));
        } catch (final Exception e) {
            if (InstantiationException.class.isInstance(e)) {
                throw InstantiationException.class.cast(e);
            }
            throw new InstantiationException(e.getMessage());
View Full Code Here

    }

    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);
        }
    }
View Full Code Here

        return f.get(obj);
    }

    public static void restoreInstanceManager(ServletContext context) {
        StandardContext stdContext = getStandardContext(context);
        InstanceManager im = getInstanceManager(stdContext);
        if (im instanceof WeldForwardingInstanceManager) {
            setInstanceManager(stdContext, ((WeldForwardingInstanceManager) im).firstProcessor);
        }
    }
View Full Code Here

                    ClassLoader loader = context.getLoader().getClassLoader();
                    Object listener = event.getData();
                   
                    if(listener.getClass().getName().equals("org.apache.webbeans.servlet.WebBeansConfigurationListener"))
                    {  
                        InstanceManager processor = context.getInstanceManager();
                        InstanceManager custom = new TomcatInstanceManager(context.getLoader().getClassLoader(),processor);
                        context.setInstanceManager(custom);
                       
                        context.getServletContext().setAttribute(InstanceManager.class.getName(), custom);
                       
                        ContextAccessController.setReadOnly(context.getNamingContextListener().getName());
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(actualClass);
            } catch (ClassCastException e) {
                unavailable(null);
                // Restore the context ClassLoader
                throw new ServletException
                    (sm.getString("standardWrapper.notServlet", actualClass), e);
View Full Code Here

                    ClassLoader loader = context.getLoader().getClassLoader();
                    Object listener = event.getData();
                   
                    if(listener.getClass().getName().equals("org.apache.webbeans.servlet.WebBeansConfigurationListener"))
                    {  
                        InstanceManager processor = context.getInstanceManager();
                        InstanceManager custom = new TomcatInstanceManager(context.getLoader().getClassLoader(),processor);
                        context.setInstanceManager(custom);
                       
                        context.getServletContext().setAttribute(InstanceManager.class.getName(), custom);
                       
                        ContextAccessController.setReadOnly(context.getNamingContextListener().getName());
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.