Search in sources :

Example 1 with WebServer

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();
}
Also used : WebServer(net.codestory.http.WebServer) CommonMode(org.icij.datashare.mode.CommonMode) URI(java.net.URI)

Aggregations

URI (java.net.URI)1 WebServer (net.codestory.http.WebServer)1 CommonMode (org.icij.datashare.mode.CommonMode)1