Package io.undertow.server

Examples of io.undertow.server.HttpHandler.handleRequest()


    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        final List<String> res = exchange.getRequestHeaders().get(Headers.ACCEPT_ENCODING);
        HttpHandler nextHandler = this.next;
        if (res == null || res.isEmpty()) {
            if (nextHandler != null) {
                nextHandler.handleRequest(exchange);
            } else {
                //we don't have an identity handler
                noEncodingHandler.handleRequest(exchange);
            }
            return;
View Full Code Here


                if (resultingMappings.isEmpty()) {
                    if (includesIdentity) {
                        noEncodingHandler.handleRequest(exchange);
                        return;
                    } else {
                        nextHandler.handleRequest(exchange);
                        return;
                    }
                }
            } else if (!available.isEmpty()) {
                Collections.sort(available, Collections.reverseOrder());
View Full Code Here

        if (!resultingMappings.isEmpty()) {
            final ContentEncoding contentEncoding = new ContentEncoding(exchange, resultingMappings);
            exchange.addResponseWrapper(contentEncoding);
            exchange.putAttachment(ContentEncoding.CONENT_ENCODING, contentEncoding);
        }
        nextHandler.handleRequest(exchange);
    }


    public HttpHandler getNext() {
        return next;
View Full Code Here

        String part = path.substring(0, pos);
        HttpHandler next = paths.get(part);
        if (next != null) {
            exchange.setRelativePath(path.substring(pos));
            exchange.setResolvedPath(exchange.getResolvedPath() + part);
            next.handleRequest(exchange);
            return;
        }

        while (pos > 1) {
            --pos;
View Full Code Here

                part = path.substring(0, pos);
                next = paths.get(part);
                if (next != null) {
                    exchange.setRelativePath(path.substring(pos));
                    exchange.setResolvedPath(exchange.getResolvedPath() + part);
                    next.handleRequest(exchange);
                    return;
                }
            }
        }
        defaultHandler.handleRequest(exchange);
View Full Code Here

            } else {
                host = hostHeader;
            }
            final HttpHandler handler = hosts.get(host);
            if (handler != null) {
                handler.handleRequest(exchange);
                return;
            }
        }
        defaultHandler.handleRequest(exchange);
    }
View Full Code Here

            } else {
                host = hostHeader;
            }
            final HttpHandler handler = hosts.get(host);
            if (handler != null) {
                handler.handleRequest(exchange);
                return;
            }
        }
        defaultHandler.handleRequest(exchange);
    }
View Full Code Here

        DefaultServer.setRootHandler(new HttpHandler() {
            @Override
            public void handleRequest(HttpServerExchange exchange) throws Exception {
                Throwable throwable = exchange.getAttachment(ExceptionHandler.THROWABLE);
                Assert.assertNull(throwable);
                exceptionHandler.handleRequest(exchange);
                throwable = exchange.getAttachment(ExceptionHandler.THROWABLE);
                Assert.assertTrue(throwable instanceof IllegalArgumentException);
            }
        });
View Full Code Here

                public void handleRequest(HttpServerExchange exchange) throws Exception {
                    if(!exchange.getRequestHeaders().contains(":method")) {
                        //make sure we have not fallen back to a stanard HTTPS connection
                        throw new RuntimeException("Not a SPDY connection");
                    }
                    existing.handleRequest(exchange);
                }
            };
        }
        if (dump) {
            rootHandler.next = new RequestDumpingHandler(handler);
View Full Code Here

        if (!exactPathMatches.isEmpty()) {
            HttpHandler match = exactPathMatches.get(path);
            if (match != null) {
                exchange.setRelativePath("");
                exchange.setResolvedPath(exchange.getResolvedPath() + path);
                match.handleRequest(exchange);
                return;
            }
        }

        int length = path.length();
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.