Package io.undertow.server.handlers

Examples of io.undertow.server.handlers.CanonicalPathHandler


        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        File newSymlink = new File(rootPath, "newSymlink");

        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, "/"))
                                    .setDirectoryListingEnabled(false)
                                    .addWelcomeFiles("page.html"))));
View Full Code Here


        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        File newSymlink = new File(rootPath, "newSymlink");

        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, rootPath.getAbsolutePath().concat("/newDir")))
                                    .setDirectoryListingEnabled(false)
                                    .addWelcomeFiles("page.html"))));
View Full Code Here

        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        File newSymlink = new File(rootPath, "newSymlink");

        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, rootPath.getAbsolutePath().concat("/otherDir")))
                                    .setDirectoryListingEnabled(false)
                                    .addWelcomeFiles("page.html"))));
View Full Code Here

        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        File newSymlink = new File(rootPath, "newSymlink");

        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, rootPath.getAbsolutePath().concat("/innerSymlink")))
                                    .setDirectoryListingEnabled(false)
                                    .addWelcomeFiles("page.html"))));
View Full Code Here

        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        File newSymlink = new File(rootPath, "newSymlink");

        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, ""))
                                    .setDirectoryListingEnabled(false)
                                    .addWelcomeFiles("page.html"))));
View Full Code Here

        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        File newSymlink = new File(rootPath, "newSymlink");

        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(newSymlink, 10485760, true, "innerDir"))
                                    .setDirectoryListingEnabled(false)
                                    .addWelcomeFiles("page.html"))));
View Full Code Here

        File rootPath = new File(FileHandlerTestCase.class.getResource("page.html").toURI()).getParentFile();

        final NameVirtualHostHandler virtualHostHandler = new NameVirtualHostHandler();
        HttpHandler root = virtualHostHandler;
        root = new SimpleErrorPageHandler(root);
        root = new CanonicalPathHandler(root);

        virtualHostHandler.addHost("default-host", pathHandler);
        virtualHostHandler.setDefaultHandler(pathHandler);

        pathHandler.addPrefixPath("/", new ResourceHandler()
View Full Code Here

    @Test
    public void testFileIsServed() throws IOException, URISyntaxException {
        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    .setResourceManager(new FileResourceManager(rootPath, 10485760))
                                    .setDirectoryListingEnabled(true))));
View Full Code Here

    @Test
    public void testFileTransfer() throws IOException, URISyntaxException {
        TestHttpClient client = new TestHttpClient();
        File rootPath = new File(getClass().getResource("page.html").toURI()).getParentFile();
        try {
            DefaultServer.setRootHandler(new CanonicalPathHandler()
                    .setNext(new PathHandler()
                            .addPrefixPath("/path", new ResourceHandler()
                                    // 1 byte = force transfer
                                    .setResourceManager(new FileResourceManager(rootPath, 1))
                                    .setDirectoryListingEnabled(true))));
View Full Code Here

    /*
    Starts simple file server, it is useful for testing directory browsing
     */
    public static void main(String[] args) throws URISyntaxException {
        File rootPath = new File(FileHandlerTestCase.class.getResource("page.html").toURI()).getParentFile().getParentFile();
        HttpHandler root = (new CanonicalPathHandler()
                .setNext(new PathHandler()
                        .addPrefixPath("/path", new ResourceHandler()
                                // 1 byte = force transfer
                                .setResourceManager(new FileResourceManager(rootPath, 1))
                                .setDirectoryListingEnabled(true))));
View Full Code Here

TOP

Related Classes of io.undertow.server.handlers.CanonicalPathHandler

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.