use of net.codestory.http.WebServer in project datashare by ICIJ.
the class WebApp method start.
static void start(Properties properties) throws Exception {
CommonMode mode = CommonMode.create(properties);
Thread webServerThread = new Thread(() -> new WebServer().withThreadCount(10).withSelectThreads(2).withWebSocketThreads(1).configure(mode.createWebConfiguration()).start(parseInt(mode.properties().getProperty(PropertiesProvider.TCP_LISTEN_PORT))));
webServerThread.start();
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE) && parseBoolean(properties.getProperty(OPEN_LINK))) {
waitForServerToBeUp(parseInt(mode.properties().getProperty(PropertiesProvider.TCP_LISTEN_PORT)));
Desktop.getDesktop().browse(URI.create(new URI("http://localhost:") + mode.properties().getProperty(PropertiesProvider.TCP_LISTEN_PORT)));
}
webServerThread.join();
}
Aggregations