diff -r 09f051f10096 -r a4a06840209a launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java --- a/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Fri Jan 25 13:26:28 2013 +0100 +++ b/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Wed Jan 30 18:27:57 2013 +0100 @@ -64,7 +64,7 @@ private Object[] brwsr; private HttpServer server; private CountDownLatch wait; - + public Bck2BrwsrLauncher(String cmd) { this.cmd = cmd; } @@ -94,7 +94,7 @@ if (!startpage.startsWith("/")) { startpage = "/" + startpage; } - HttpServer s = initServer(); + HttpServer s = initServer(".", true); s.getServerConfiguration().addHttpHandler(new Page(resources, null), "/"); try { launchServerAndBrwsr(s, startpage); @@ -103,6 +103,18 @@ } } + void showDirectory(File dir, String startpage) throws IOException { + if (!startpage.startsWith("/")) { + startpage = "/" + startpage; + } + HttpServer s = initServer(dir.getPath(), false); + try { + launchServerAndBrwsr(s, startpage); + } catch (URISyntaxException | InterruptedException ex) { + throw new IOException(ex); + } + } + @Override public void initialize() throws IOException { try { @@ -122,18 +134,20 @@ } } - private HttpServer initServer() throws IOException { - HttpServer s = HttpServer.createSimpleServer(".", new PortRange(8080, 65535)); + private HttpServer initServer(String path, boolean addClasses) throws IOException { + HttpServer s = HttpServer.createSimpleServer(path, new PortRange(8080, 65535)); final ServerConfiguration conf = s.getServerConfiguration(); - conf.addHttpHandler(new VM(resources), "/vm.js"); - conf.addHttpHandler(new Classes(resources), "/classes/"); + if (addClasses) { + conf.addHttpHandler(new VM(resources), "/vm.js"); + conf.addHttpHandler(new Classes(resources), "/classes/"); + } return s; } private void executeInBrowser() throws InterruptedException, URISyntaxException, IOException { wait = new CountDownLatch(1); - server = initServer(); + server = initServer(".", true); ServerConfiguration conf = server.getServerConfiguration(); conf.addHttpHandler(new Page(resources, "org/apidesign/bck2brwsr/launcher/harness.xhtml"