Package org.apache.catalina.core

Examples of org.apache.catalina.core.StandardContext


        Tomcat tomcat = getTomcatInstance();

        File appDir =
            new File("test/webapp-3.0");
        // app dir is relative to server home
        StandardContext ctxt = (StandardContext) tomcat.addWebapp(null,
                "/test", appDir.getAbsolutePath());
       
        // This test needs the JSTL libraries
        File lib = new File("webapps/examples/WEB-INF/lib");
        ctxt.setAliases("/WEB-INF/lib=" + lib.getCanonicalPath());
       
        tomcat.start();

        int rc = getUrl("http://localhost:" + getPort() +
                "/test/bug48nnn/bug48701-fail.jsp", new ByteChunk(), null);
View Full Code Here


    @Test
    public void testStartInternal() throws Exception {
        Tomcat tomcat = getTomcatInstance();
        File appDir = new File("test/webapp-3.0");     
        // Must have a real docBase - just use temp
        StandardContext ctx =
            (StandardContext)tomcat.addContext("",  appDir.getAbsolutePath());

        VirtualWebappLoader loader = new VirtualWebappLoader();
        
        loader.setContainer(ctx);
        ctx.setLoader(loader);
        ctx.setResources(new FileDirContext());
        ctx.resourcesStart();
        File dir = new File("test/webapp-3.0-fragments/WEB-INF/lib");
        loader.setVirtualClasspath(dir.getAbsolutePath() + "/*.jar");
        loader.start();
        String[] repos = loader.getRepositories();
        assertEquals(2,repos.length);
        loader.stop();
        // ToDo: Why doesn't remove repositories?
        repos = loader.getRepositories();
        assertEquals(2, repos.length);
       
        // no leak
        loader.start();
        repos = loader.getRepositories();
        assertEquals(2,repos.length);
       
        // clear loader
        ctx.setLoader(null);
        // see tearDown()!
        tomcat.start();
    }
View Full Code Here

        boolean result = true;
        log.info("restartContext(" + context.getName() + ")");

        if (context instanceof StandardContext) {
            try {
                StandardContext sctx = (StandardContext)context;
                sctx.reload();
            } catch (Exception e) {
                log.warn(sm.getString
                         ("hostConfig.context.restart", context.getName()), e);
                result = false;
            }
View Full Code Here

        if( initialized ) return;
        initialized=true;       
       
        if( oname==null ) {
            try {
                StandardContext ctx=(StandardContext)this.getContainer();
                Engine eng=(Engine)ctx.getParent().getParent();
                domain=ctx.getEngineName();
                StandardHost hst=(StandardHost)ctx.getParent();
                String path = ctx.getPath();
                if (path.equals("")) {
                    path = "/";
                }  
                oname=new ObjectName(domain + ":type=Manager,path="
                + path + ",host=" + hst.getName());
View Full Code Here

        if( log.isDebugEnabled() )
            log.debug("Creating context '" + path + "' with docBase '" +
                       docBase + "'");

        StandardContext context = new StandardContext();

        context.setDebug(debug);
        context.setDocBase(docBase);
        context.setPath(path);

        ContextConfig config = new ContextConfig();
        config.setDebug(debug);
        ((Lifecycle) context).addLifecycleListener(config);
View Full Code Here

            int i = name.indexOf("/");
            String hostName = name.substring(0,i);
            String path = name.substring(i);
            Host host = (Host) engine.findChild(hostName);
            String pathStr = getPathStr(path);
            StandardContext context = (StandardContext)host.findChild(pathStr);
            return context;
        } else if (type != null) {
            if (type.equals("Engine")) {
                return engine;
            } else if (type.equals("Host")) {
View Full Code Here

            return host;
        } else {               
            // child's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            return context;
        }
    }
View Full Code Here

    public String createStandardContext(String parent, String path,
                                        String docBase)
        throws Exception {

        // Create a new StandardContext instance
        StandardContext context = new StandardContext();
        path = getPathStr(path);
        context.setPath(path);
        context.setDocBase(docBase);
        ContextConfig contextConfig = new ContextConfig();
        context.addLifecycleListener(contextConfig);

        // Add the new instance to its parent component
        ObjectName pname = new ObjectName(parent);
        Service service = getService(pname);
        Engine engine = (Engine) service.getContainer();
View Full Code Here

            int i = name.indexOf("/");
            String hostName = name.substring(0,i);
            String path = name.substring(i);
            Host host = (Host) engine.findChild(hostName);
            String pathStr = getPathStr(path);
            StandardContext context = (StandardContext)host.findChild(pathStr);
            return context;
        } else if (type != null) {
            if (type.equals("Engine")) {
                return engine;
            } else if (type.equals("Host")) {
View Full Code Here

            return host;
        } else {               
            // child's container is Context
            StandardHost host = (StandardHost) engine.findChild(hostName);
            path = getPathStr(path);
            StandardContext context = (StandardContext) host.findChild(path);
            return context;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.core.StandardContext

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.