Search in sources :

Example 1 with Config

use of io.helidon.config.Config 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;
}
Also used : Config(io.helidon.config.Config) LogManager(java.util.logging.LogManager) WebServer(io.helidon.webserver.WebServer) MetroSupport(org.eclipse.metro.helidon.MetroSupport) IOException(java.io.IOException) ConfigSources(io.helidon.config.ConfigSources) Routing(io.helidon.webserver.Routing) InputStream(java.io.InputStream) WebServer(io.helidon.webserver.WebServer) Config(io.helidon.config.Config)

Example 2 with Config

use of io.helidon.config.Config 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;
}
Also used : Config(io.helidon.config.Config) LogManager(java.util.logging.LogManager) WebServer(io.helidon.webserver.WebServer) MetroSupport(org.eclipse.metro.helidon.MetroSupport) IOException(java.io.IOException) ConfigSources(io.helidon.config.ConfigSources) Routing(io.helidon.webserver.Routing) InputStream(java.io.InputStream) WebServer(io.helidon.webserver.WebServer) Config(io.helidon.config.Config)

Example 3 with Config

use of io.helidon.config.Config 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;
}
Also used : Config(io.helidon.config.Config) LogManager(java.util.logging.LogManager) WebServer(io.helidon.webserver.WebServer) MetroSupport(org.eclipse.metro.helidon.MetroSupport) IOException(java.io.IOException) ConfigSources(io.helidon.config.ConfigSources) Routing(io.helidon.webserver.Routing) InputStream(java.io.InputStream) WebServer(io.helidon.webserver.WebServer) Config(io.helidon.config.Config)

Example 4 with Config

use of io.helidon.config.Config 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;
}
Also used : Config(io.helidon.config.Config) LogManager(java.util.logging.LogManager) WebServer(io.helidon.webserver.WebServer) MetroSupport(org.eclipse.metro.helidon.MetroSupport) IOException(java.io.IOException) ConfigSources(io.helidon.config.ConfigSources) Routing(io.helidon.webserver.Routing) RestService(org.eclipse.metro.helidon.example.client.RestService) InputStream(java.io.InputStream) WebServer(io.helidon.webserver.WebServer) Config(io.helidon.config.Config)

Example 5 with Config

use of io.helidon.config.Config 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;
}
Also used : Config(io.helidon.config.Config) LogManager(java.util.logging.LogManager) WebServer(io.helidon.webserver.WebServer) MetroSupport(org.eclipse.metro.helidon.MetroSupport) IOException(java.io.IOException) ConfigSources(io.helidon.config.ConfigSources) Routing(io.helidon.webserver.Routing) InputStream(java.io.InputStream) WebServer(io.helidon.webserver.WebServer) Config(io.helidon.config.Config)

Aggregations

Config (io.helidon.config.Config)329 Test (org.junit.jupiter.api.Test)169 LogConfig (io.helidon.common.LogConfig)56 WebServer (io.helidon.webserver.WebServer)54 Routing (io.helidon.webserver.Routing)51 BeforeAll (org.junit.jupiter.api.BeforeAll)24 Security (io.helidon.security.Security)20 HealthSupport (io.helidon.health.HealthSupport)18 Single (io.helidon.common.reactive.Single)17 MetricsSupport (io.helidon.metrics.MetricsSupport)16 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)16 ConfigSources (io.helidon.config.ConfigSources)15 JsonpSupport (io.helidon.media.jsonp.JsonpSupport)15 SecurityContext (io.helidon.security.SecurityContext)15 Optional (java.util.Optional)15 TimeUnit (java.util.concurrent.TimeUnit)15 WebSecurity (io.helidon.security.integration.webserver.WebSecurity)13 HealthChecks (io.helidon.health.checks.HealthChecks)12 WebClient (io.helidon.webclient.WebClient)12 GrpcRouting (io.helidon.grpc.server.GrpcRouting)11