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();
// everything is configured through application.yaml
Server server = Server.create();
now = System.nanoTime() - now;
System.out.println("Create server: " + TimeUnit.MILLISECONDS.convert(now, TimeUnit.NANOSECONDS));
now = System.nanoTime();
server.start();
port = server.port();
now = System.nanoTime() - now;
System.out.println("Start server: " + TimeUnit.MILLISECONDS.convert(now, TimeUnit.NANOSECONDS));
System.out.println("Endpoint available at http://localhost:" + port + "/helloworld");
}
use of io.helidon.microprofile.server.Server in project helidon by oracle.
the class Main method main.
/**
* Starts server manually.
*
* @param args command line arguments (ignored)
*/
public static void main(String[] args) {
Server server = Server.builder().host("localhost").port(0).build();
server.start();
String endpoint = "http://" + server.host() + ":" + server.port();
System.out.println("Started application on " + endpoint + "/helloworld");
System.out.println("Metrics available on " + endpoint + "/metrics");
System.out.println("Heatlh checks available on " + endpoint + "/health");
}
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) {
LogConfig.configureRuntime();
Server server = startServer();
System.out.println("http://localhost:" + server.port() + "/books");
}
use of io.helidon.microprofile.server.Server in project helidon by oracle.
the class Mp1Main method main.
/**
* Application main entry point.
* @param args command line arguments.
*/
public static void main(final String[] args) {
String property = System.getProperty("java.class.path");
if (null == property || property.trim().isEmpty()) {
System.out.println("** Running on module path");
} else {
System.out.println("** Running on class path");
}
// cleanup before tests
cleanup();
String jwtToken = generateJwtToken();
// start CDI
// Main.main(args);
Server server = Server.builder().port(7001).applications(new JaxRsApplicationNoCdi()).retainDiscoveredApplications(true).basePath("/cdi").build().start();
boolean failed = false;
long now = System.currentTimeMillis();
try {
testBean(server.port(), jwtToken);
} catch (Exception e) {
e.printStackTrace();
failed = true;
}
long time = System.currentTimeMillis() - now;
System.out.println("Tests finished in " + time + " millis");
// Config config = ConfigProvider.getConfig();
// List<String> names = new ArrayList<>();
// config.getPropertyNames()
// .forEach(names::add);
// names.sort(String::compareTo);
// System.out.println("All configuration options:");
// names.forEach(it -> {
// config.getOptionalValue(it, String.class)
// .ifPresent(value -> System.out.println(it + "=" + value));
// });
server.stop();
if (failed) {
System.exit(-1);
}
}
use of io.helidon.microprofile.server.Server in project helloworld-web by dbelob.
the class Main method startServer.
/**
* Start the server.
*
* @return the created {@link Server} instance
* @throws IOException if there are problems reading logging properties
*/
protected static Server startServer() throws IOException {
// load logging configuration
LogManager.getLogManager().readConfiguration(Main.class.getResourceAsStream("/logging.properties"));
// Server will automatically pick up configuration from
// microprofile-config.properties
Server server = Server.create();
server.start();
return server;
}
Aggregations