Package org.apache.catalina.webresources

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


                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, "/WEB-INF/classes",
                f1.getAbsolutePath(), null, "/");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",
                f2.getAbsolutePath(), null, "/");

        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, "/WEB-INF/classes",
                f1.getAbsolutePath(), null, "/");
        ctx.getResources().createWebResourceSet(
                WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",
View Full Code Here

        // 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

        File appDir = new File("test/webapp");
        // app dir is relative to server home
        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, "/WEB-INF/lib",
View Full Code Here

        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, "/WEB-INF/lib",
                lib.getAbsolutePath(), null, "/");

        tomcat.start();
View Full Code Here

        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, "/WEB-INF/lib",
                lib.getAbsolutePath(), null, "/");

        tomcat.start();
View Full Code Here

        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, "/WEB-INF/lib",
                lib.getAbsolutePath(), null, "/");

        tomcat.start();
View Full Code Here

        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

            }
        });

        loader = new TomEEWebappClassLoader(ParentClassLoaderFinder.Helper.get());
        loader.init();
        final StandardRoot resources = new StandardRoot();
        loader.setResources(resources);
        resources.setContext(new StandardContext() {
            @Override
            public String getDocBase() {
                final File file = new File("target/foo");
                file.mkdirs();
                return file.getAbsolutePath();
            }

            @Override
            public String getMBeanKeyProperties() {
                return "foo";
            }
        {}});
        resources.start();
        loader.start();

        info = new AppInfo();
        info.appId = "test";
        context = new AppContext(info.appId, SystemInstance.get(), loader, new IvmContext(), new IvmContext(), true);
View Full Code Here

                assertNotNull(afterLoader);
                assertEquals(0, afterLoader.getURLs().length);
                assertEquals(LifecycleState.STOPPED, loader.getState());
            }

            final StandardRoot resources = new StandardRoot();
            loader.setResources(resources);
            resources.setContext(new StandardContext() {
                @Override
                public String getDocBase() {
                    final File file = new File("target/foo");
                    file.mkdirs();
                    return file.getAbsolutePath();
                }

                @Override
                public String getMBeanKeyProperties() {
                    return "foo";
                }
                {}});
            resources.start();
            loader.start();
            // TomcatWebAppBuilder ill catch start event from StandardCo1ntext and force a classloader
            Reflections.set(loader, "parent", ParentClassLoaderFinder.Helper.get());

            server.afterApplicationCreated(new AssemblerAfterApplicationCreated(info, context, Collections.<BeanContext>emptyList()));
View Full Code Here

TOP

Related Classes of org.apache.catalina.webresources.StandardRoot

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.