Package io.undertow.server

Examples of io.undertow.server.HttpHandler


                        pathServlet = extensionServlets.get(entry.getKey());
                    }
                    if (pathServlet == null) {
                        pathServlet = defaultServlet;
                    }
                    HttpHandler handler = pathServlet;
                    if (!entry.getValue().isEmpty()) {
                        handler = new FilterHandler(entry.getValue(), handler);
                    }
                    builder.addExtensionMatch(prefix, entry.getKey(), servletChain(handler, pathServlet.getManagedServlet()));
                }
View Full Code Here


        }
        return new ApplicationListeners(managedListeners, deployment.getServletContext());
    }

    private ServletChain servletChain(HttpHandler next, final ManagedServlet managedServlet) {
        HttpHandler servletHandler = new ServletSecurityRoleHandler(next);
        servletHandler = new SSLInformationAssociationHandler(servletHandler);
        servletHandler = wrapHandlers(servletHandler, managedServlet.getServletInfo().getHandlerChainWrappers());
        servletHandler = wrapHandlers(servletHandler, deployment.getDeploymentInfo().getDispatchedHandlerChainWrappers());
        return new ServletChain(servletHandler, managedServlet);
    }
View Full Code Here

        servletHandler = wrapHandlers(servletHandler, deployment.getDeploymentInfo().getDispatchedHandlerChainWrappers());
        return new ServletChain(servletHandler, managedServlet);
    }

    private HttpHandler wrapHandlers(final HttpHandler wrapee, final List<HandlerWrapper> wrappers) {
        HttpHandler current = wrapee;
        for (HandlerWrapper wrapper : wrappers) {
            current = wrapper.wrap(current);
        }
        return current;
    }
View Full Code Here

        try {
            deployment.getDeploymentInfo().getSessionManager().start();
            for (Lifecycle object : deployment.getLifecycleObjects()) {
                object.start();
            }
            HttpHandler root = deployment.getServletHandler();

            //create the executor, if it exists
            if (deployment.getDeploymentInfo().getExecutorFactory() != null) {
                try {
                    executor = deployment.getDeploymentInfo().getExecutorFactory().createInstance();
View Full Code Here

                port = portScout.getNextFreePort();
            } finally {
                portScout.close();
            }

            undertow = Undertow.builder().addHttpListener(port, "localhost").setHandler(new HttpHandler() {
                @Override
                public void handleRequest(HttpServerExchange httpServerExchange) throws Exception {
                    httpServerExchange.startBlocking();
                    FileInputStream in = new FileInputStream(
                        getFileFromTestClasses("ant-properties/in-bundle.properties"));
View Full Code Here

            public int compare(FilterRef o1, FilterRef o2) {
                return o1.getPriority() >= o2.getPriority() ? 1 : -1;
            }
        });
        Collections.reverse(filters); //handler chain goes last first
        HttpHandler handler = rootHandler;
        for (FilterRef filter : filters) {
            handler = filter.createHttpHandler(handler);
        }

        return handler;
View Full Code Here

    @Override
    public void handleDeployment(final DeploymentInfo deploymentInfo, final ServletContext servletContext) {
        deploymentInfo.addInitialHandlerChainWrapper(new HandlerWrapper() {
            @Override
            public HttpHandler wrap(final HttpHandler handler) {
                return new HttpHandler() {
                    @Override
                    public void handleRequest(final HttpServerExchange exchange) throws Exception {
                        if(Thread.currentThread() != exchange.getIoThread()) {
                            exchange.setResponseCode(500);
                            exchange.getResponseSender().send("Response was dispatched, not running in IO thread", IoCallback.END_EXCHANGE);
View Full Code Here

            manager.deploy();
        }

        @Override
        public void start() throws Exception {
            HttpHandler handler = manager.start();
            host.getValue().registerDeployment(manager.getDeployment(), handler);
        }
View Full Code Here

        //this is a bit of a hack at the moment. Basically we only want to create a single mod_cluster instance
        //not matter how many filter refs use it, also mod_cluster at this point has no way
        //to specify the next handler. To get around this we invoke the mod_proxy handler
        //and then if it has not dispatched or handled the request then we know that we can
        //just pass it on to the next handler
        final HttpHandler mcmp = config.create(modCluster, next);
        final HttpHandler proxyHandler = modCluster.getProxyHandler();
        HttpHandler theHandler = new HttpHandler() {
            @Override
            public void handleRequest(HttpServerExchange exchange) throws Exception {
                proxyHandler.handleRequest(exchange);
                if(!exchange.isDispatched() && !exchange.isComplete()) {
                    exchange.setResponseCode(200);
View Full Code Here

        return name;
    }

    public HttpHandler createHttpHandler(final Predicate predicate, final ModelNode model, HttpHandler next) {
        List<AttributeDefinition> attributes = new ArrayList<>(getAttributes());
        HttpHandler handler = createHandler(getHandlerClass(), model, attributes, next);
        if (predicate != null) {
            return Handlers.predicate(predicate, handler, next);
        } else {
            return handler;
        }
View Full Code Here

TOP

Related Classes of io.undertow.server.HttpHandler

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.