I use a RAP application with an embedded server. [message #855776] |
Wed, 25 April 2012 05:01 |
|
like this.
wiki.eclipse.org/RAP/FAQ#How_do_I_use_a_RAP_application_with_an_embedded_server
I have a question.
When start the Jetty server, the system browser is opens wish.
Start from the Eclipse IDE as RAP Application.
Help me. thanks.
|
|
|
Re: I use a RAP application with an embedded server. [message #856260 is a reply to message #855776] |
Wed, 25 April 2012 14:07 |
|
Activator...
public void start(...) {
.....
TadpoleOpenBrowser openBrowser = new TadpoleOpenBrowser();
Thread the = new Thread(openBrowser);
the.start();
}
public class TadpoleOpenBrowser implements Runnable {
private static final Logger logger = Logger.getLogger(TadpoleOpenBrowser.class);
public static final String url = "127.0.0.1:10081/db?startup=tadpole";
@Override
public void run() {
String s1 = System.getProperty("os.name").toLowerCase();
Runtime runtime = Runtime.getRuntime();
try {
// 시스템 속도가 느려서 워크벤치가 정상적으로 동작하지 못했을 경우에 대비하여 기다립니다.
try { Thread.sleep(1000); } catch(Exception e) {};
// window
if (s1.indexOf("windows") >= 0) {
runtime.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler", url });
// mac
} else if (s1.indexOf("mac") >= 0) {
Runtime.getRuntime().exec(new String[] { "open", url });
// linux
} else {
// linux
String as[] = { "firefox", "mozilla-firefox", "mozilla", "konqueror", "netscape", "opera" };
boolean isSuccess = false;
int i = 0;
do {
if (i >= as.length)
break;
try {
runtime.exec(new String[] {as[i], url });
isSuccess = true;
break;
} catch (Exception exception) {
i++;
}
} while (true);
if (!isSuccess) logger.info("standlone open url exception ");
}
} catch (Exception e) {
logger.error("standalone start open URL", e);
}
} // end run
} // end class TadpoleOpenBrowser
|
|
|
Powered by
FUDForum. Page generated in 0.01788 seconds