launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java
changeset 1076 892dcb178737
parent 1048 a4b4d500e7e6
child 1081 47687dce809a
     1.1 --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java	Sun Apr 28 22:10:57 2013 +0200
     1.2 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java	Sun May 05 18:16:43 2013 +0200
     1.3 @@ -35,6 +35,7 @@
     1.4  import java.util.List;
     1.5  import java.util.Set;
     1.6  import java.util.concurrent.BlockingQueue;
     1.7 +import java.util.concurrent.Callable;
     1.8  import java.util.concurrent.CountDownLatch;
     1.9  import java.util.concurrent.LinkedBlockingQueue;
    1.10  import java.util.concurrent.TimeUnit;
    1.11 @@ -56,7 +57,7 @@
    1.12   * Supports execution in native browser as well as Java's internal 
    1.13   * execution engine.
    1.14   */
    1.15 -final class Bck2BrwsrLauncher extends Launcher implements Closeable {
    1.16 +final class Bck2BrwsrLauncher extends Launcher implements Closeable, Callable<HttpServer> {
    1.17      private static final Logger LOG = Logger.getLogger(Bck2BrwsrLauncher.class.getName());
    1.18      private static final InvocationContext END = new InvocationContext(null, null, null);
    1.19      private final Set<ClassLoader> loaders = new LinkedHashSet<>();
    1.20 @@ -103,6 +104,7 @@
    1.21          String prefix = startpage.substring(0, last);
    1.22          String simpleName = startpage.substring(last);
    1.23          s.getServerConfiguration().addHttpHandler(new SubTree(resources, prefix), "/");
    1.24 +        server = s;
    1.25          try {
    1.26              launchServerAndBrwsr(s, simpleName);
    1.27          } catch (URISyntaxException | InterruptedException ex) {
    1.28 @@ -443,6 +445,11 @@
    1.29      }
    1.30  
    1.31      @Override
    1.32 +    public HttpServer call() throws Exception {
    1.33 +        return server;
    1.34 +    }
    1.35 +    
    1.36 +    @Override
    1.37      public void close() throws IOException {
    1.38          shutdown();
    1.39      }