Package io.undertow

Examples of io.undertow.Undertow.start()


                        StreamUtil.safeClose(in);
                    }
                }
            }).build();

            undertow.start();

            String deployXmlContents = StreamUtil.slurp(new InputStreamReader(new FileInputStream(deployXml)));

            deployXmlContents = deployXmlContents.replace("%%REPLACE_ME%%", "url=\"http://localhost:" + port + "\"");
View Full Code Here


                                exchange.getResponseSender().send(body);
                            }
                        }
                    }
                }).build();
        server.start();
        LOGGER.info("Started mock server on host {} and port {} for mock {}", host, port, mock);

        // remember
        running.put(port, server);
View Full Code Here

            server = Undertow.builder()
                    .addHttpListener(cport, chost)
                    .addHttpListener(pport, phost)
                    .setHandler(mcmp)
                    .build();
            server.start();

            // Start advertising the mcmp handler
            modCluster.advertise(config);

        } catch (Exception e) {
View Full Code Here

                            exchange.getResponseSender().send("Server1");
                        }
                    })
                    .build();

            server1.start();

            final Undertow server2 = Undertow.builder()
                    .addListener(8082, "localhost")
                    .setHandler(new HttpHandler() {
                        @Override
View Full Code Here

                            exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
                            exchange.getResponseSender().send("Server2");
                        }
                    })
                    .build();
            server2.start();

            final Undertow server3 = Undertow.builder()
                    .addListener(8083, "localhost")
                    .setHandler(new HttpHandler() {
                        @Override
View Full Code Here

                            exchange.getResponseSender().send("Server3");
                        }
                    })
                    .build();

            server3.start();

            LoadBalancingProxyClient loadBalancer = new LoadBalancingProxyClient()
                    .addHost(new URI("http://localhost:8081"))
                    .addHost(new URI("http://localhost:8082"))
                    .addHost(new URI("http://localhost:8083"))
View Full Code Here

            Undertow reverseProxy = Undertow.builder()
                    .addListener(8080, "localhost")
                    .setIoThreads(4)
                    .setHandler(new ProxyHandler(loadBalancer, 30000, ResponseCodeHandler.HANDLE_404))
                    .build();
            reverseProxy.start();

        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

                        final SecurityContext context = exchange.getSecurityContext();
                        exchange.getResponseSender().send("Hello " + context.getAuthenticatedAccount().getPrincipal().getName(), IoCallback.END_EXCHANGE);
                    }
                }, identityManager))
                .build();
        server.start();
    }

    private static HttpHandler addSecurity(final HttpHandler toWrap, final IdentityManager identityManager) {
        HttpHandler handler = toWrap;
        handler = new AuthenticationCallHandler(handler);
View Full Code Here

                    .addPrefixPath(MYAPP, servletHandler);
            Undertow server = Undertow.builder()
                    .addListener(8080, "localhost")
                    .setHandler(path)
                    .build();
            server.start();
        } catch (ServletException e) {
            throw new RuntimeException(e);
        }
    }
}
View Full Code Here

                        }))
                        .addPrefixPath("/", resource(new ClassPathResourceManager(ChatServer.class.getClassLoader(), ChatServer.class.getPackage()))
                                .addWelcomeFiles("index.html")))
                .build();

        server.start();
    }

}
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.