use of io.helidon.webserver.Routing in project metro-jax-ws by eclipse-ee4j.
the class Main method startServer.
static WebServer startServer() {
setupLogging();
// By default this will pick up application.yaml from the classpath
Config config = buildConfig();
// Get webserver config from the "server" section of application.yaml
WebServer server = WebServer.builder().config(config.get("server")).routing(buildRouting(config)).build();
// Try to start the server. If successful, print some info and arrange to
// print a message at shutdown. If unsuccessful, print the exception.
server.start().thenAccept(ws -> {
System.out.println("WEB server is up! http://localhost:" + ws.port());
ws.whenShutdown().thenRun(() -> System.out.println("WEB server is DOWN. Good bye!"));
}).exceptionally(t -> {
System.err.println("Startup failed: " + t.getMessage());
t.printStackTrace(System.err);
return null;
});
// Server threads are not daemon. No need to block. Just react.
return server;
}
Aggregations