public abstract class Launcher extends Object
JavaScript engine,
or in external browser.
There also are methods to display pages
in an external browser served by internal HTTP server.
| Modifier and Type | Method and Description |
|---|---|
static Launcher |
createBrowser(String cmd)
Creates launcher that is using external browser.
|
static Launcher |
createBrowser(String cmd,
ClassLoader classes,
String startpage)
Creates launcher that is using external browser.
|
InvocationContext |
createInvocation(Class<?> clazz,
String method)
Builds an invocation context.
|
static Launcher |
createJavaScript()
Creates launcher that uses internal JavaScript engine (Rhino).
|
abstract void |
initialize()
Initializes the launcher.
|
static Closeable |
showDir(File directory,
String startpage)
Starts an HTTP server which provides access to certain directory.
|
static Closeable |
showDir(String brwsr,
File directory,
ClassLoader classes,
String startpage)
Starts an HTTP server which provides access to certain directory.
|
static Closeable |
showURL(ClassLoader classes,
String startpage)
Starts an HTTP server which provides access to classes and resources
available in the
classes URL and shows a start page
available as ClassLoader.getResource(java.lang.String) from the
provide classloader. |
static Closeable |
showURL(String brwsr,
ClassLoader classes,
String startpage)
Starts an HTTP server which provides access to classes and resources
available in the
classes URL and shows a start page
available as ClassLoader.getResource(java.lang.String) from the
provide classloader. |
abstract void |
shutdown()
Shuts down the launcher.
|
public abstract void initialize()
throws IOException
IOException - if something goes wrongpublic abstract void shutdown()
throws IOException
IOException - if something goes wrongpublic InvocationContext createInvocation(Class<?> clazz, String method)
invoked.clazz - the class to execute method frommethod - the method to executepublic static Launcher createJavaScript()
public static Launcher createBrowser(String cmd)
cmd - null to use java.awt.Desktop to show the launcher
or a string to execute in an external process (with a parameter to the URL)public static Launcher createBrowser(String cmd, ClassLoader classes, String startpage)
classes - classloader offering access to classes and resourcesstartpage - page to show in the browsercmd - null to use java.awt.Desktop to show the launcher
or a string to execute in an external process (with a parameter to the URL)public static Closeable showURL(ClassLoader classes, String startpage) throws IOException
classes URL and shows a start page
available as ClassLoader.getResource(java.lang.String) from the
provide classloader. Opens a browser with URL showing the start page.classes - classloader offering access to classes and resourcesstartpage - page to show in the browserIOException - if something goes wrongpublic static Closeable showURL(String brwsr, ClassLoader classes, String startpage) throws IOException
classes URL and shows a start page
available as ClassLoader.getResource(java.lang.String) from the
provide classloader. Opens a browser with URL showing the start page.brwsr - name of browser to use or nullclasses - classloader offering access to classes and resourcesstartpage - page to show in the browserIOException - if something goes wrongpublic static Closeable showDir(String brwsr, File directory, ClassLoader classes, String startpage) throws IOException
startpage should be relative location inside the root
directory. Opens a browser with URL showing the start page.brwsr - type of the browser to usedirectory - the root directory on diskclasses - additional classloader with access to classes or nullstartpage - relative path from the root to the pageIOException - if something goes wrong.public static Closeable showDir(File directory, String startpage) throws IOException
startpage should be relative location inside the root
directory. Opens a browser with URL showing the start page.directory - the root directory on diskstartpage - relative path from the root to the pageIOException - if something goes wrong.Copyright © 2021 API Design. All Rights Reserved.