Examples of addPrefixPath()


Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

    @Test
    public void testBasicPathHanding() throws IOException {
        TestHttpClient client = new TestHttpClient();
        try {
            final PathHandler handler = new PathHandler();
            handler.addPrefixPath("a", new RemainingPathHandler("/a"));
            handler.addPrefixPath("/aa", new RemainingPathHandler("/aa"));
            handler.addExactPath("/aa", new HttpHandler() {
                @Override
                public void handleRequest(HttpServerExchange exchange) throws Exception {
                    exchange.getResponseSender().send("Exact /aa match:" + exchange.getRelativePath() + ":" + exchange.getResolvedPath());
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

    public void testBasicPathHanding() throws IOException {
        TestHttpClient client = new TestHttpClient();
        try {
            final PathHandler handler = new PathHandler();
            handler.addPrefixPath("a", new RemainingPathHandler("/a"));
            handler.addPrefixPath("/aa", new RemainingPathHandler("/aa"));
            handler.addExactPath("/aa", new HttpHandler() {
                @Override
                public void handleRequest(HttpServerExchange exchange) throws Exception {
                    exchange.getResponseSender().send("Exact /aa match:" + exchange.getRelativePath() + ":" + exchange.getResolvedPath());
                }
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

                @Override
                public void handleRequest(HttpServerExchange exchange) throws Exception {
                    exchange.getResponseSender().send("Exact /aa match:" + exchange.getRelativePath() + ":" + exchange.getResolvedPath());
                }
            });
            handler.addPrefixPath("/aa/anotherSubPath", new RemainingPathHandler("/aa/anotherSubPath"));

            final PathHandler sub = new PathHandler();

            handler.addPrefixPath("/path", sub);
            sub.addPrefixPath("/subpath", new RemainingPathHandler("/subpath"));
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

            handler.addPrefixPath("/aa/anotherSubPath", new RemainingPathHandler("/aa/anotherSubPath"));

            final PathHandler sub = new PathHandler();

            handler.addPrefixPath("/path", sub);
            sub.addPrefixPath("/subpath", new RemainingPathHandler("/subpath"));
            sub.addPrefixPath("/", new RemainingPathHandler("/path"));

            DefaultServer.setRootHandler(handler);

            HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/notamatchingpath");
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

            final PathHandler sub = new PathHandler();

            handler.addPrefixPath("/path", sub);
            sub.addPrefixPath("/subpath", new RemainingPathHandler("/subpath"));
            sub.addPrefixPath("/", new RemainingPathHandler("/path"));

            DefaultServer.setRootHandler(handler);

            HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/notamatchingpath");
            HttpResponse result = client.execute(get);
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

@UndertowExample("Session Handling")
public class SessionServer {

    public static void main(String[] args) {
        PathHandler pathHandler = new PathHandler();
        pathHandler.addPrefixPath("/", new HttpHandler() {
            public void handleRequest(HttpServerExchange exchange)
                    throws Exception {
                StringBuilder sb = new StringBuilder();
                sb.append("<form action='addToSession' >");
                sb.append("<label>Attribute Name</label>");
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

                exchange.getResponseHeaders().add(Headers.CONTENT_TYPE,
                        "text/html;");
                exchange.getResponseSender().send(sb.toString());
            }
        });
        pathHandler.addPrefixPath("/addToSession", new HttpHandler() {
            @Override
            public void handleRequest(HttpServerExchange exchange)
                    throws Exception {
                SessionManager sm = exchange
                        .getAttachment(SessionManager.ATTACHMENT_KEY);
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

                exchange.setResponseCode(StatusCodes.TEMPORARY_REDIRECT);
                exchange.getResponseHeaders().put(Headers.LOCATION, "/");
                exchange.getResponseSender().close();
            }
        });
        pathHandler.addPrefixPath("/destroySession", new HttpHandler() {
            public void handleRequest(HttpServerExchange exchange)
                    throws Exception {
                SessionManager sm = exchange
                        .getAttachment(SessionManager.ATTACHMENT_KEY);
                SessionConfig sessionConfig = exchange
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

        final PathHandler root = new PathHandler();
        final ServletContainer container = ServletContainer.Factory.newInstance();
        DeploymentManager manager = container.addDeployment(builder);
        manager.deploy();
        root.addPrefixPath(builder.getContextPath(), manager.start());

        DefaultServer.setRootHandler(root);
        return manager.getDeployment().getServletContext();
    }
View Full Code Here

Examples of io.undertow.server.handlers.PathHandler.addPrefixPath()

        root = new CanonicalPathHandler(root);

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

        pathHandler.addPrefixPath("/", new ResourceHandler()
                .setResourceManager(new FileResourceManager(rootPath, 10485760))
                .setDirectoryListingEnabled(true));

        DefaultServer.setRootHandler(root);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.