use of org.gradle.plugins.javascript.envjs.http.simple.internal.SimpleFileServerContainer in project gradle by gradle.
the class SimpleHttpFileServerFactory method start.
public HttpFileServer start(File contentRoot, int port) {
Container container = new SimpleFileServerContainer(new FileContext(contentRoot));
try {
final Server server = new ContainerServer(container);
Connection connection = new SocketConnection(server);
InetSocketAddress address = new InetSocketAddress(port);
InetSocketAddress usedAddress = (InetSocketAddress) connection.connect(address);
return new SimpleHttpFileServer(contentRoot, usedAddress.getPort(), new Stoppable() {
public void stop() {
try {
server.stop();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
});
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
Aggregations