Adds the specified listener to the server instance.
listener
If the server is already running when this method is called, the listener will be started.
256257258259260261262263264265266
listener.setSecure(secure); if (sslEngineConfigurator != null) { listener.setSSLEngineConfig(sslEngineConfigurator); } server.addListener(listener); // Map the path to the processor. final ServerConfiguration config = server.getServerConfiguration(); if (handler != null) { config.addHttpHandler(handler, uri.getPath());
8889909192939495969798
*/ public static HttpServer startServer(String webRootPath) { final HttpServer server = new HttpServer(); final NetworkListener listener = new NetworkListener("grizzly", "localhost", PORT); server.addListener(listener); final ServerConfiguration config = server.getServerConfiguration(); // add handler for serving static content config.addHttpHandler(new StaticContentHandler(webRootPath), APP_PATH);