Examples of StandardRoot


Examples of org.apache.catalina.webresources.StandardRoot

            return;
        }

        switch (event.getType()) {
            case Lifecycle.BEFORE_START_EVENT:
                final WebResourceRoot resources = new StandardRoot(context);
                context.setResources(resources);
                if (!module.getProperties().containsKey("fakeJarLocation")) {
                    context.setDocBase(module.getJarLocation());
                }

                // move last fake folder, tomcat is broken without it so we can't remove it
                final List allResources = List.class.cast(Reflections.get(resources, "allResources"));
                final Object mainResources = allResources.remove(1);
                allResources.add(mainResources);

                for (final URL url : module.getScannableUrls()) {
                    final File file = URLs.toFile(url);
                    final String absolutePath = file.getAbsolutePath();
                    if (file.isDirectory()) {
                        resources.createWebResourceSet(WebResourceRoot.ResourceSetType.CLASSES_JAR, "/WEB-INF/classes", absolutePath, "", "/");
                        if (new File(file, "META-INF/resources").exists()) {
                            resources.createWebResourceSet(WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/", absolutePath, "", "/META-INF/resources");
                        }
                    } else {
                        resources.createWebResourceSet(WebResourceRoot.ResourceSetType.CLASSES_JAR, "/WEB-INF/lib", absolutePath, null, "/");
                        resources.createWebResourceSet(WebResourceRoot.ResourceSetType.RESOURCE_JAR, "/", url, "/META-INF/resources");
                    }
                }
                break;
            case Lifecycle.CONFIGURE_START_EVENT:
                SystemInstance.get().getComponent(TomcatWebAppBuilder.class).setFinderOnContextConfig(StandardContext.class.cast(data), module.appModule());
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        // Must have a real docBase - just use temp
        StandardContext ctx = (StandardContext)
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));

        File lib = new File("webapps/examples/WEB-INF/lib");
        ctx.setResources(new StandardRoot(ctx));
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
                "/WEB-INF/lib", "/");

View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        if (getResources() == null) {   // (1) Required by Loader
            if (log.isDebugEnabled())
                log.debug("Configuring default Resources");

            try {
                setResources(new StandardRoot(this));
            } catch (IllegalArgumentException e) {
                log.error("Error initializing resources: " + e.getMessage());
                ok = false;
            }
        }
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        Tomcat tomcat = getTomcatInstance();

        File appDir = new File("test/webapp");
        Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        ctx.setResources(new StandardRoot(ctx));

        // Add the JSTL (we need the TLD)
        File lib = new File("webapps/examples/WEB-INF/lib");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        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.setResources(new StandardRoot(ctxt));
        ctxt.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
                "/WEB-INF/lib", "/");

        tomcat.start();
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        File appDir = new File("test/webapp-virtual-webapp/src/main/webapp");
        // app dir is relative to server home
        StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
            appDir.getAbsolutePath());

        ctx.setResources(new StandardRoot(ctx));
        File f1 = new File("test/webapp-virtual-webapp/target/classes");
        File f2 = new File("test/webapp-virtual-library/target/classes");
        File f3 = new File(
                "test/webapp-virtual-webapp/src/main/webapp/WEB-INF/classes");
        File f4 = new File(
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

                MyAnnotatedServlet.class.getSimpleName() + ".class"));
        IOUtils.copy(annotatedServletClassInputStream, annotatedServletClassOutputStream);
        annotatedServletClassInputStream.close();
        annotatedServletClassOutputStream.close();

        ctx.setResources(new StandardRoot(ctx));
        File f1 = new File("test/webapp-virtual-webapp/target/classes");
        File f2 = new File("test/webapp-virtual-library/target/classes");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, f1.getAbsolutePath(),
                "/WEB-INF/classes", "/");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, f2.getAbsolutePath(),
                "/WEB-INF/classes", "/");

        tomcat.start();
        // first test that without the setting on StandardContext the annotated
        // servlet is not detected
        assertPageContains("/test/annotatedServlet", MyAnnotatedServlet.MESSAGE, 404);

        tomcat.stop();

        // then test that if we configure StandardContext with the additional
        // path, the servlet is detected
        ctx.setResources(new StandardRoot(ctx));
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, f1.getAbsolutePath(),
                "/WEB-INF/classes", "/");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, f2.getAbsolutePath(),
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        WebappLoader loader = new WebappLoader();

        loader.setContext(ctx);
        ctx.setLoader(loader);

        ctx.setResources(new StandardRoot(ctx));
        ctx.resourcesStart();

        File f1 = new File("test/webapp-fragments/WEB-INF/lib");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, f1.getAbsolutePath(),
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        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.setResources(new StandardRoot(ctxt));
        ctxt.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
                "/WEB-INF/lib", "/");

        tomcat.start();
View Full Code Here

Examples of org.apache.catalina.webresources.StandardRoot

        // app dir is relative to server home
        Context ctxt = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

        // This test needs the JSTL libraries
        File lib = new File("webapps/examples/WEB-INF/lib");
        ctxt.setResources(new StandardRoot(ctxt));
        ctxt.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib",
                lib.getAbsolutePath(), null, "/");

        tomcat.start();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.