Thread: [Winstone-devel] Launcher.java patch: define start URL in embedded.properties
Status: Beta
Brought to you by:
rickknowles
From: Simon H. <sim...@gm...> - 2009-12-28 20:08:23
|
Hi, I wanted to have the possibility to display my web app directly after the user starts winstone. For this, I added the following code (inspired from Thomas Mueller of h2.org) to Launcher.java just before Runtime.getRuntime().addShutdownHook(new ShutdownHook(this)); // open browser String url = (String) args.get("openOnStartUrl"); if (null != url) { String osName = System.getProperty("os.name"); if (null != osName) { osName = osName.toLowerCase(); Runtime rt = Runtime.getRuntime(); if (osName.indexOf("windows") >= 0) { rt.exec(new String[]{"rundll32", "url.dll,FileProtocolHandler", url}); } else if (osName.indexOf("mac") >= 0) { rt.exec(new String[]{"open", url}); } else { // TBD } } } Feel free to add to the code if you deem approriate. BTW: I am using winstone for http://code.google.com/p/mailxel/ Regards, Simon. |