Merge with default branch classloader
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 26 Jun 2013 19:37:34 +0200
branchclassloader
changeset 1229592cb4e0f363
parent 1228 462dd9238173
parent 1173 aa82f9de8e33
child 1230 466c30fd9cb0
Merge with default branch
     1.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/WebDebug.java	Wed Jun 26 19:29:54 2013 +0200
     1.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/WebDebug.java	Wed Jun 26 19:37:34 2013 +0200
     1.3 @@ -66,11 +66,13 @@
     1.4      @Override
     1.5      public void run() {
     1.6          try {
     1.7 -            String p = "/home/jarda/src/bck2brwsr/html~demo/twitter/src/main/resources/org/apidesign/html/demo/twitter/index.html";
     1.8 -            File f = new File(p);
     1.9 -            String[] args = {"--livehtml", f.getAbsolutePath()};
    1.10 -            File dir = f.getParentFile();
    1.11 -            cliHandler(args, toDbg, this, System.err, dir);
    1.12 +            String p = System.getProperty("startpage.file");
    1.13 +            File f;
    1.14 +            if (p != null && (f = new File(p)).exists()) {
    1.15 +                String[] args = {"--livehtml", f.getAbsolutePath()};
    1.16 +                File dir = f.getParentFile();
    1.17 +                cliHandler(args, toDbg, this, System.err, dir);
    1.18 +            }
    1.19          } catch (Exception ex) {
    1.20              LOG.log(Level.SEVERE, null, ex);
    1.21          }
    1.22 @@ -152,7 +154,7 @@
    1.23                  for (;;) {
    1.24                      WebDebug.this.flush();
    1.25                      try {
    1.26 -                        current = pending.poll(100, TimeUnit.MILLISECONDS);
    1.27 +                        current = pending.poll(5, TimeUnit.MILLISECONDS);
    1.28                          if (current == null) {
    1.29                              return 0;
    1.30                          }
     2.1 --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrwsrMojo.java	Wed Jun 26 19:29:54 2013 +0200
     2.2 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/BrwsrMojo.java	Wed Jun 26 19:37:34 2013 +0200
     2.3 @@ -29,6 +29,7 @@
     2.4  import java.util.Collection;
     2.5  import java.util.List;
     2.6  import org.apache.maven.artifact.Artifact;
     2.7 +import org.apache.maven.model.Resource;
     2.8  import org.apache.maven.plugin.MojoExecutionException;
     2.9  import org.apache.maven.plugins.annotations.LifecyclePhase;
    2.10  import org.apache.maven.plugins.annotations.Mojo;
    2.11 @@ -75,7 +76,6 @@
    2.12          if (startpage == null) {
    2.13              throw new MojoExecutionException("You have to provide a start page");
    2.14          }
    2.15 -        
    2.16          try {
    2.17              Closeable httpServer;
    2.18              if (directory != null) {
    2.19 @@ -83,6 +83,13 @@
    2.20              } else {
    2.21                  URLClassLoader url = buildClassLoader(classes, prj.getArtifacts());
    2.22                  try {
    2.23 +                    for (Resource r : prj.getResources()) {
    2.24 +                        File f = new File(r.getDirectory(), startpage().replace('/', File.separatorChar));
    2.25 +                        if (f.exists()) {
    2.26 +                            System.setProperty("startpage.file", f.getPath());
    2.27 +                        }
    2.28 +                    }
    2.29 +                    
    2.30                      httpServer = Launcher.showURL(launcher, url, startpage());
    2.31                  } catch (Exception ex) {
    2.32                      throw new MojoExecutionException("Can't open " + startpage(), ex);