Package org.apache.catalina.startup

Examples of org.apache.catalina.startup.ContextConfig


            log.debug("Creating EJBWebService context '" + contextPath + "'.");

        TomcatEJBWebServiceContext context = new TomcatEJBWebServiceContext(contextPath, webServiceContainer, classLoader);
        Subject defaultSubject = ContextManager.EMPTY;
        WebAppInfo webAppInfo = new WebAppInfo();
        ContextConfig config = new EjbWsContextConfig(webAppInfo, policyContextId,  configurationFactory, defaultSubject, authMethod, realmName);
        context.addLifecycleListener(config);

        String virtualServer;
        if (virtualHosts != null && virtualHosts.length > 0) {
            virtualServer = virtualHosts[0];
View Full Code Here


        context.setPath(path);

        if (cl != null)
            context.setParentClassLoader(cl);

        ContextConfig config = new WebContextConfig(webAppInfo);
        context.addLifecycleListener(config);

        context.setDelegate(true);
        return context;
View Full Code Here

                String contextXmlFile = webApp.codebase + "/META-INF/context.xml";
                if (new File(contextXmlFile).exists()) {
                    standardContext.setConfigFile(contextXmlFile);
                    standardContext.setOverride(true);
                }
                ContextConfig contextConfig = new ContextConfig();
                standardContext.addLifecycleListener(contextConfig);

                standardContext.setPath("/" + webApp.contextRoot);
                standardContext.setDocBase(webApp.codebase);
                standardContext.setParentClassLoader(classLoader);
View Full Code Here

        context.setXmlValidation(xmlValidation);
        context.setXmlNamespaceAware(xmlNamespaceAware);
        context.setTldValidation(tldValidation);
        context.setTldNamespaceAware(tldNamespaceAware);
       
        ContextConfig contextConfig = new ContextConfig();
        context.addLifecycleListener(contextConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ObjectName deployer = new ObjectName(pname.getDomain()+
View Full Code Here

           
            if(contained instanceof StandardHost){
                HostConfig config = new HostConfig();
                contained.addLifecycleListener(config);
            } else if(contained instanceof StandardContext){
                ContextConfig config = new ContextConfig();
                contained.addLifecycleListener(config);
            }

        } catch (InstantiationException e) {
            throw new MBeanException(e);
View Full Code Here

                }
                if (configClassname != null) {
                    Class clazz = Class.forName(String.valueOf(configClassname));
                    config = (LifecycleListener) clazz.newInstance();
                } else {
                    config = new ContextConfig();
                }
            } catch (Exception e) {
                log.warn("Error creating ContextConfig for " + parentName, e);
                throw e;
            }
View Full Code Here

        context.setXmlValidation(xmlValidation);
        context.setXmlNamespaceAware(xmlNamespaceAware);
        context.setTldValidation(tldValidation);
        context.setTldNamespaceAware(tldNamespaceAware);
       
        ContextConfig contextConfig = new ContextConfig();
        context.addLifecycleListener(contextConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ObjectName deployer = new ObjectName(pname.getDomain()+
View Full Code Here

        StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
                appDir.getAbsolutePath());
        LifecycleListener[] listener = ctx.findLifecycleListeners();
        assertEquals(3,listener.length);
        assertTrue(listener[1] instanceof ContextConfig);
        ContextConfig config = new ContextConfig() {
            @Override
            protected WebXml createWebXml() {
                WebXml wxml = new WebXml();
                wxml.addAbsoluteOrdering("resources");
                wxml.addAbsoluteOrdering("resources2");
                return wxml;
            }
        };
        // prevent it from looking ( if it finds one - it'll have dup error )
        config.setDefaultWebXml(Constants.NoDefaultWebXml);
        listener[1] = config;
        Tomcat.addServlet(ctx, "getresource", new GetResourceServlet());
        ctx.addServletMapping("/getresource", "getresource");

        tomcat.start();
        assertPageContains("/test/getresource?path=/resourceF.jsp",
        "<p>resourceF.jsp in resources2.jar</p>");
        assertPageContains("/test/getresource?path=/resourceB.jsp",
        "<p>resourceB.jsp in resources.jar</p>");

        // Check ordering, for BZ 54391
        assertEquals(Arrays.asList("resources.jar", "resources2.jar"), ctx
                .getServletContext().getAttribute(ServletContext.ORDERED_LIBS));

        ctx.stop();

        LifecycleListener[] listener1 = ctx.findLifecycleListeners();
        // change ordering and reload
        ContextConfig config1 = new ContextConfig() {
            @Override
            protected WebXml createWebXml() {
                WebXml wxml = new WebXml();
                wxml.addAbsoluteOrdering("resources2");
                wxml.addAbsoluteOrdering("resources");
                return wxml;
            }
        };
        // prevent it from looking ( if it finds one - it'll have dup error )
        config1.setDefaultWebXml(Constants.NoDefaultWebXml);
        listener1[1] = config1;
        // Need to init since context won't call init
        config1.lifecycleEvent(
                new LifecycleEvent(ctx, Lifecycle.AFTER_INIT_EVENT, null));
        Tomcat.addServlet(ctx, "getresource", new GetResourceServlet());
        ctx.addServletMapping("/getresource", "getresource");

        ctx.start();
View Full Code Here

        context.setXmlValidation(xmlValidation);
        context.setXmlNamespaceAware(xmlNamespaceAware);
        context.setTldValidation(tldValidation);
        context.setTldNamespaceAware(tldNamespaceAware);
       
        ContextConfig contextConfig = new ContextConfig();
        context.addLifecycleListener(contextConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        ObjectName deployer = new ObjectName(pname.getDomain()+
View Full Code Here

                }
                if (configClassName != null) {
                    Class clazz = Class.forName(configClassName);
                    config = (LifecycleListener) clazz.newInstance();
                } else {
                    config = new ContextConfig();
                }
            } catch (Exception e) {
                log.warn("Error creating ContextConfig for " + parentName, e);
                throw e;
            }
View Full Code Here

TOP

Related Classes of org.apache.catalina.startup.ContextConfig

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.