use of io.helidon.webserver.Routing in project visuale by Cantara.
the class Main method startServer.
public WebServer startServer(int port, String contextPath) {
Routing routing = Routing.builder().register(contextPath, healthResource).register(contextPath, statusResource).register(contextPath + "/favicon.ico", StaticContentSupport.builder("/nuxt-spa/dist/favicon.ico").build()).register(contextPath + "/nuxt-spa", StaticContentSupport.builder("/nuxt-spa").build()).register(contextPath + "/_nuxt", StaticContentSupport.builder("/nuxt-spa/dist/_nuxt").build()).register(contextPath + "/", StaticContentSupport.builder("/nuxt-spa/dist").welcomeFileName("index.html").build()).build();
WebServer ws = WebServer.builder().port(port).addMediaSupport(JacksonSupport.create()).routing(routing).build();
// start the server
// Server server = startServer();
ws.start().thenApply(webServer -> {
if (accessToken == null || accessToken.length() < 1) {
String endpoint = "http://localhost:" + webServer.port() + contextPath;
System.out.println("- Visit Dashboard at: " + endpoint + "/?ui_extension=groupByTag&servicetype=true");
System.out.println(" - Health checks available on: " + endpoint + "/health");
System.out.println(" - Environment status available on: " + endpoint + "/status/");
} else {
String endpoint = "http://localhost:" + webServer.port() + contextPath;
System.out.println(" Visit Dashboard at: " + endpoint + "/?accessToken=" + accessToken + "&ui_extension=groupByTag&servicetype=true");
System.out.println(" - Health checks available on: " + endpoint + "/health");
System.out.println(" - Environment status available on: " + endpoint + "/status/?accessToken=" + accessToken);
}
return null;
});
return ws;
}
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;
}
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;
}
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;
}
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