1.1 --- a/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java Sun Apr 28 17:42:49 2013 +0200
1.2 +++ b/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java Sun Apr 28 21:17:04 2013 +0200
1.3 @@ -82,12 +82,16 @@
1.4 String msg = "Trying to create browser '" + cmd + "'";
1.5 try {
1.6 Class<?> c;
1.7 - if ("fx".equals(cmd)) { // NOI18N
1.8 + if ("fxbrwsr".equals(cmd)) { // NOI18N
1.9 msg = "Please include org.apidesign.bck2brwsr:launcher.fx dependency!";
1.10 c = loadClass("org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher"); // NOI18N
1.11 } else {
1.12 msg = "Please include org.apidesign.bck2brwsr:launcher.html dependency!";
1.13 c = loadClass("org.apidesign.bck2brwsr.launcher.Bck2BrwsrLauncher"); // NOI18N
1.14 + if ("bck2brwsr".equals(cmd)) { // NOI18N
1.15 + // use default executable
1.16 + cmd = null;
1.17 + }
1.18 }
1.19 Constructor<?> cnstr = c.getConstructor(String.class);
1.20 return (Launcher) cnstr.newInstance(cmd);
1.21 @@ -107,7 +111,22 @@
1.22 * @throws IOException if something goes wrong
1.23 */
1.24 public static Closeable showURL(ClassLoader classes, String startpage) throws IOException {
1.25 - Launcher l = createBrowser(null);
1.26 + return showURL(null, classes, startpage);
1.27 + }
1.28 + /** Starts an HTTP server which provides access to classes and resources
1.29 + * available in the <code>classes</code> URL and shows a start page
1.30 + * available as {@link ClassLoader#getResource(java.lang.String)} from the
1.31 + * provide classloader. Opens a browser with URL showing the start page.
1.32 + *
1.33 + * @param brwsr name of browser to use or <code>null</code>
1.34 + * @param classes classloader offering access to classes and resources
1.35 + * @param startpage page to show in the browser
1.36 + * @return interface that allows one to stop the server
1.37 + * @throws IOException if something goes wrong
1.38 + * @since 0.7
1.39 + */
1.40 + public static Closeable showURL(String brwsr, ClassLoader classes, String startpage) throws IOException {
1.41 + Launcher l = createBrowser(brwsr);
1.42 l.addClassLoader(classes);
1.43 l.showURL(startpage);
1.44 return (Closeable) l;