Package org.apache.catalina

Examples of org.apache.catalina.WebResource


        Assert.assertFalse(resourceRoot.mkdir(getMount() + "/"));
    }

    @Test
    public final void testMkdirDirA() {
        WebResource d1 = resourceRoot.getResource(getMount() + "/d1");
        if (d1.exists()) {
            Assert.assertFalse(resourceRoot.mkdir(getMount() + "/d1"));
        } else if (d1.isVirtual()) {
            Assert.assertTrue(resourceRoot.mkdir(getMount() + "/d1"));
            File file = new File(getBaseDir(), "d1");
            Assert.assertTrue(file.isDirectory());
            Assert.assertTrue(file.delete());
        } else {
View Full Code Here


        }
    }

    @Test
    public final void testMkdirDirB() {
        WebResource d1 = resourceRoot.getResource(getMount() + "/d1/");
        if (d1.exists()) {
            Assert.assertFalse(resourceRoot.mkdir(getMount() + "/d1/"));
        } else if (d1.isVirtual()) {
            Assert.assertTrue(resourceRoot.mkdir(getMount() + "/d1/"));
            File file = new File(getBaseDir(), "d1");
            Assert.assertTrue(file.isDirectory());
            Assert.assertTrue(file.delete());
        } else {
View Full Code Here

        Assert.assertFalse(resourceRoot.write(getMount() + "/", is, false));
    }

    @Test
    public final void testWriteDirA() {
        WebResource d1 = resourceRoot.getResource(getMount() + "/d1");
        InputStream is = new ByteArrayInputStream("test".getBytes());
        if (d1.exists()) {
            Assert.assertFalse(resourceRoot.write(getMount() + "/d1", is, false));
        } else if (d1.isVirtual()) {
            Assert.assertTrue(resourceRoot.write(
                    getMount() + "/d1", is, false));
            File file = new File(getBaseDir(), "d1");
            Assert.assertTrue(file.exists());
            Assert.assertTrue(file.delete());
View Full Code Here

        }
    }

    @Test
    public final void testWriteDirB() {
        WebResource d1 = resourceRoot.getResource(getMount() + "/d1/");
        InputStream is = new ByteArrayInputStream("test".getBytes());
        if (d1.exists()) {
            Assert.assertFalse(resourceRoot.write(getMount() + "/d1/", is, false));
        } else if (d1.isVirtual()) {
            Assert.assertTrue(resourceRoot.write(
                    getMount() + "/d1/", is, false));
            File file = new File(getBaseDir(), "d1");
            Assert.assertTrue(file.exists());
            Assert.assertTrue(file.delete());
View Full Code Here

    // ------------------------------------------------------ getCanonicalPath()

    @Test
    public final void testGetCanonicalPathExists() {
        WebResource exists =
                resourceRoot.getResource(getMount() + "/d1/d1-f1.txt");
        String existsCanonicalPath = exists.getCanonicalPath();

        URL existsUrl = exists.getURL();
        if ("file".equals(existsUrl.getProtocol())) {
            // Should have a canonical path
            Assert.assertNotNull(existsCanonicalPath);
        } else {
            Assert.assertNull(existsCanonicalPath);
View Full Code Here

        }
    }

    @Test
    public final void testGetCanonicalPathDoesNotExist() {
        WebResource exists =
                resourceRoot.getResource(getMount() + "/d1/d1-f1.txt");
        WebResource doesNotExist =
                resourceRoot.getResource(getMount() + "/d1/dummy.txt");
        String doesNotExistCanonicalPath = doesNotExist.getCanonicalPath();

        URL existsUrl = exists.getURL();
        if ("file".equals(existsUrl.getProtocol())) {
            // Should be possible to construct a canonical path for a resource
            // that doesn't exist given that a resource that does exist in the
View Full Code Here

        return main.write(path, is, overwrite);
    }

    private boolean preResourceExists(String path) {
        for (WebResourceSet webResourceSet : preResources) {
            WebResource webResource = webResourceSet.getResource(path);
            if (webResource.exists()) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        return RequestUtil.normalize(path);
    }

    protected final WebResource getResourceInternal(String path,
            boolean useClassLoaderResources) {
        WebResource result = null;
        WebResource virtual = null;
        WebResource mainEmpty = null;
        for (ArrayList<WebResourceSet> list : allResources) {
            for (WebResourceSet webResourceSet : list) {
                if (useClassLoaderResources || !webResourceSet.getClassLoaderOnly()) {
                    result = webResourceSet.getResource(path);
                    if (result.exists()) {
View Full Code Here

        ArrayList<WebResource> result = new ArrayList<>();
        for (ArrayList<WebResourceSet> list : allResources) {
            for (WebResourceSet webResourceSet : list) {
                if (useClassLoaderResources || !webResourceSet.getClassLoaderOnly()) {
                    WebResource webResource = webResourceSet.getResource(path);
                    if (webResource.exists()) {
                        result.add(webResource);
                    }
                }
            }
        }
View Full Code Here

        return main.write(path, is, overwrite);
    }

    private boolean preResourceExists(String path) {
        for (WebResourceSet webResourceSet : preResources) {
            WebResource webResource = webResourceSet.getResource(path);
            if (webResource.exists()) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.WebResource

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.