Search in sources :

Example 1 with Server

use of io.helidon.microprofile.server.Server in project helidon by oracle.

the class OidcMain method main.

/**
 * Start the application.
 * @param args ignored.
 */
public static void main(String[] args) {
    Server server = Server.builder().config(buildConfig()).build().start();
    System.out.println("http://localhost:" + server.port() + "/test");
}
Also used : Server(io.helidon.microprofile.server.Server)

Example 2 with Server

use of io.helidon.microprofile.server.Server in project helidon by oracle.

the class AbacJerseyMain method startIt.

static Server startIt() {
    Config config = Config.create();
    Server server = Server.builder().config(config).port(8080).build().start();
    System.out.printf("Started server on localhost:%d%n", server.port());
    System.out.println();
    System.out.println("***********************");
    System.out.println("** Endpoints:        **");
    System.out.println("***********************");
    System.out.println("Using declarative authorization (ABAC):");
    System.out.printf("  http://localhost:%1$d/rest/attributes%n", server.port());
    System.out.println("Using explicit authorization (ABAC):");
    System.out.printf("  http://localhost:%1$d/rest/explicit%n", server.port());
    return server;
}
Also used : Server(io.helidon.microprofile.server.Server) Config(io.helidon.config.Config)

Example 3 with Server

use of io.helidon.microprofile.server.Server in project helidon by oracle.

the class Main method main.

/**
 * Run this example.
 *
 * @param args command line arguments (ignored)
 */
public static void main(String[] args) {
    long now = System.nanoTime();
    Server server = Server.create(StaticContentApp.class, OtherApp.class).start();
    now = System.nanoTime() - now;
    System.out.println("Start server: " + TimeUnit.MILLISECONDS.convert(now, TimeUnit.NANOSECONDS));
    System.out.println("Endpoint available at http://localhost:" + server.port() + "/static/helloworld");
    System.out.println("Alternative endpoint (second application) available at http://localhost:" + server.port() + "/other/helloworld");
}
Also used : Server(io.helidon.microprofile.server.Server)

Example 4 with Server

use of io.helidon.microprofile.server.Server in project helidon by oracle.

the class Main method main.

/**
 * Application main entry point.
 *
 * @param args command line arguments
 */
public static void main(final String[] args) {
    // load logging configuration
    LogConfig.configureRuntime();
    Config config = buildConfig();
    // as we need to use custom filter
    // we need to build Server with custom config
    Server server = Server.builder().config(config).build();
    server.start();
}
Also used : Server(io.helidon.microprofile.server.Server) Config(io.helidon.config.Config) LogConfig(io.helidon.common.LogConfig)

Example 5 with Server

use of io.helidon.microprofile.server.Server in project helidon by oracle.

the class TestCORS method init.

@BeforeAll
static void init() {
    Config serverConfig = Config.create().get("server");
    Server.Builder serverBuilder = Server.builder();
    serverConfig.ifExists(serverBuilder::config);
    server = serverBuilder.port(// override the port for testing
    -1).build().start();
    client = WebClient.builder().baseUri("http://localhost:" + server.port()).addMediaSupport(JSONP_SUPPORT).build();
}
Also used : Server(io.helidon.microprofile.server.Server) Config(io.helidon.config.Config) CrossOriginConfig(io.helidon.webserver.cors.CrossOriginConfig) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

Server (io.helidon.microprofile.server.Server)10 Config (io.helidon.config.Config)3 LogConfig (io.helidon.common.LogConfig)1 CrossOriginConfig (io.helidon.webserver.cors.CrossOriginConfig)1 ServiceUnavailableException (jakarta.ws.rs.ServiceUnavailableException)1 IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (org.eclipse.microprofile.faulttolerance.exceptions.TimeoutException)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1