net.i2p.apps.systray
Class UrlLauncher

java.lang.Object
  extended by net.i2p.apps.systray.UrlLauncher

public class UrlLauncher
extends java.lang.Object

A quick and simple multi-platform URL launcher. It attempts to launch the default browser for the host platform first, then popular third-party browsers if that was not successful.

Handles Galeon, Internet Explorer, Konqueror, Links, Lynx, Mozilla, Mozilla Firefox, Netscape, Opera, and Safari.

Author:
hypercubus

Field Summary
(package private)  ShellCommand _shellCommand
           
 
Constructor Summary
UrlLauncher()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 boolean openUrl(java.lang.String url)
          Discovers the operating system the installer is running under and tries to launch the given URL using the default browser for that platform; if unsuccessful, an attempt is made to launch the URL using the most common browsers.
 boolean openUrl(java.lang.String url, java.lang.String browser)
          Opens the given URL with the given browser.
 boolean waitForServer(java.lang.String urlString)
          Prevent bad user experience by waiting for the server to be there before launching the browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_shellCommand

ShellCommand _shellCommand
Constructor Detail

UrlLauncher

public UrlLauncher()
Method Detail

waitForServer

public boolean waitForServer(java.lang.String urlString)
Prevent bad user experience by waiting for the server to be there before launching the browser.

Returns:
success

openUrl

public boolean openUrl(java.lang.String url)
                throws java.lang.Exception
Discovers the operating system the installer is running under and tries to launch the given URL using the default browser for that platform; if unsuccessful, an attempt is made to launch the URL using the most common browsers.

Parameters:
url - The URL to open.
Returns:
true if the operation was successful, otherwise false.
Throws:
java.lang.Exception

openUrl

public boolean openUrl(java.lang.String url,
                       java.lang.String browser)
                throws java.lang.Exception
Opens the given URL with the given browser.

Parameters:
url - The URL to open.
browser - The browser to use.
Returns:
true if the operation was successful, otherwise false.
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)