launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java
changeset 1271 46e2b4ef85a4
parent 1043 bd80952bfd11
child 1273 37ad459579bc
     1.1 --- a/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java	Sun Apr 28 21:17:04 2013 +0200
     1.2 +++ b/launcher/api/src/main/java/org/apidesign/bck2brwsr/launcher/Launcher.java	Mon Sep 09 06:08:00 2013 +0200
     1.3 @@ -135,14 +135,34 @@
     1.4       * The <code>startpage</code> should be relative location inside the root 
     1.5       * directory. Opens a browser with URL showing the start page.
     1.6       * 
     1.7 +     * @param brwsr type of the browser to use
     1.8 +     * @param directory the root directory on disk
     1.9 +     * @param classes additional classloader with access to classes or <code>null</code>
    1.10 +     * @param startpage relative path from the root to the page
    1.11 +     * @return instance of server that can be closed
    1.12 +     * @exception IOException if something goes wrong.
    1.13 +     * @since 0.8
    1.14 +     */
    1.15 +    public static Closeable showDir(String brwsr, File directory, ClassLoader classes, String startpage) throws IOException {
    1.16 +        Launcher l = createBrowser(brwsr);
    1.17 +        if (classes != null) {
    1.18 +            l.addClassLoader(classes);
    1.19 +        }
    1.20 +        l.showDirectory(directory, startpage);
    1.21 +        return (Closeable) l;
    1.22 +    }
    1.23 +    
    1.24 +    /** Starts an HTTP server which provides access to certain directory.
    1.25 +     * The <code>startpage</code> should be relative location inside the root 
    1.26 +     * directory. Opens a browser with URL showing the start page.
    1.27 +     * 
    1.28       * @param directory the root directory on disk
    1.29       * @param startpage relative path from the root to the page
    1.30 +     * @return instance of server that can be closed
    1.31       * @exception IOException if something goes wrong.
    1.32       */
    1.33      public static Closeable showDir(File directory, String startpage) throws IOException {
    1.34 -        Launcher l = createBrowser(null);
    1.35 -        l.showDirectory(directory, startpage);
    1.36 -        return (Closeable) l;
    1.37 +        return showDir(null, directory, null, startpage);
    1.38      }
    1.39  
    1.40      abstract InvocationContext runMethod(InvocationContext c) throws IOException;