Package io.undertow.server.handlers

Examples of io.undertow.server.handlers.PathHandler


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

        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


        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

        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

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

        try {
            DefaultServer.setRootHandler(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

        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

    @BeforeClass
    public static void setup() throws ServletException {


        final PathHandler pathHandler = new PathHandler();
        final ServletContainer container = ServletContainer.Factory.newInstance();
        DeploymentInfo builder = new DeploymentInfo()
                .setClassLoader(SimpleServletTestCase.class.getClassLoader())
                .setContextPath("/servletContext")
                .setClassIntrospecter(TestClassIntrospector.INSTANCE)
                .setDeploymentName("servletContext.war")
                .addListener(new ListenerInfo(SessionCookieConfigListener.class))
                .addServlets(new ServletInfo("servlet", SessionServlet.class)
                        .addMapping("/aa/b"));
        DeploymentManager manager = container.addDeployment(builder);
        manager.deploy();
        try {
            pathHandler.addPrefixPath(builder.getContextPath(), manager.start());
        } catch (ServletException e) {
            throw new RuntimeException(e);
        }
        DefaultServer.setRootHandler(pathHandler);
    }
View Full Code Here

        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

        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

        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

@RunWith(DefaultServer.class)
public class ContentTypeFilesTestCase {

    @BeforeClass
    public static void setup() throws ServletException {
        final PathHandler root = new PathHandler();
        final ServletContainer container = ServletContainer.Factory.newInstance();

        DeploymentInfo builder = new DeploymentInfo()
                .setClassIntrospecter(TestClassIntrospector.INSTANCE)
                .setClassLoader(ContentTypeFilesTestCase.class.getClassLoader())
                .setContextPath("/app")
                .setDeploymentName("servletContext.war")
                .setResourceManager(new TestResourceLoader(ContentTypeServlet.class))
                .setDefaultServletConfig(new DefaultServletConfig(true))
                .addMimeMapping(new MimeMapping("jnlp", "application/x-java-jnlp-file"));

        DeploymentManager manager = container.addDeployment(builder);
        manager.deploy();
        root.addPrefixPath(builder.getContextPath(), manager.start());
        DefaultServer.setRootHandler(root);
    }
View Full Code Here

TOP

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

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.