Package org.apache.catalina

Examples of org.apache.catalina.WebResource


     * Get the readme file as a string.
     */
    protected String getReadme(WebResource directory) {

        if (readmeFile != null) {
            WebResource resource = resources.getResource(
                    directory.getWebappPath() + readmeFile);
            if (resource.isFile()) {
                StringWriter buffer = new StringWriter();
                InputStream is = resource.getInputStream();
                copyRange(new InputStreamReader(is),
                        new PrintWriter(buffer));
                return buffer.toString();
            } else {
                if (debug > 10)
View Full Code Here


     */
    protected InputStream findXsltInputStream(WebResource directory)
        throws IOException {

        if (localXsltFile != null) {
            WebResource resource = resources.getResource(
                    directory.getWebappPath() + localXsltFile);
            if (resource.isFile()) {
                InputStream is = resource.getInputStream();
                if (is != null) {
                    return is;
                }
            }
            if (debug > 10) {
View Full Code Here

    //------------------------------------------------------------ getResource()

    @Test
    public final void testGetResourceRoot() {
        WebResource webResource = resourceRoot.getResource(getMount() + "/");
        Assert.assertTrue(webResource.isDirectory());
        String expected;
        if (getMount().length() > 0) {
            expected = getMount().substring(1);
        } else {
            expected = "";
        }
        Assert.assertEquals(expected, webResource.getName());
        Assert.assertEquals(getMount() + "/", webResource.getWebappPath());
    }
View Full Code Here

        Assert.assertEquals(getMount() + "/", webResource.getWebappPath());
    }

    @Test
    public final void testGetResourceDirA() {
        WebResource webResource = resourceRoot.getResource(getMount() + "/d1");
        Assert.assertTrue(webResource.isDirectory());
        Assert.assertEquals("d1", webResource.getName());
        Assert.assertEquals(getMount() + "/d1/", webResource.getWebappPath());
    }
View Full Code Here

        Assert.assertEquals(getMount() + "/d1/", webResource.getWebappPath());
    }

    @Test
    public final void testGetResourceDirB() {
        WebResource webResource = resourceRoot.getResource(getMount() + "/d1/");
        Assert.assertTrue(webResource.isDirectory());
        Assert.assertEquals("d1", webResource.getName());
        Assert.assertEquals(getMount() + "/d1/", webResource.getWebappPath());
    }
View Full Code Here

        Assert.assertEquals(getMount() + "/d1/", webResource.getWebappPath());
    }

    @Test
    public final void testGetResourceFile() {
        WebResource webResource =
                resourceRoot.getResource(getMount() + "/d1/d1-f1.txt");
        Assert.assertTrue(webResource.isFile());
        Assert.assertEquals("d1-f1.txt", webResource.getName());
        Assert.assertEquals(
                getMount() + "/d1/d1-f1.txt", webResource.getWebappPath());
    }
View Full Code Here

        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

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.