Package net.i2p.apps.systray
Class UrlLauncher
java.lang.Object
net.i2p.apps.systray.UrlLauncher
- All Implemented Interfaces:
ClientApp
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
-
Constructor Summary
ConstructorDescriptionConstructor from SysTrayUrlLauncher
(I2PAppContext context, ClientAppManager mgr, String[] args) ClientApp constructor used from clients.config -
Method Summary
Modifier and TypeMethodDescriptionClientApp interfacegetName()
ClientApp interfacegetState()
ClientApp interfacestatic void
Obsolete, now uses ClientApp interfaceboolean
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
Opens the given URL with the given browser.void
ClientApp interfacevoid
startup()
ClientApp interface As of 0.9.46, stops immediately if JVM is a Windows or Linux Service.
-
Constructor Details
-
UrlLauncher
ClientApp constructor used from clients.config- Parameters:
mgr
- null OKargs
- URL in args[0] or null args for router console- Since:
- 0.9.18
-
UrlLauncher
public UrlLauncher()Constructor from SysTray- Since:
- 0.9.18
-
-
Method Details
-
openUrl
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. As of 0.9.46, fails immediately if JVM is a Windows or Linux Service. BLOCKING. This repeatedly probes the server port at the given url until it is apparently ready.- Parameters:
url
- The URL to open.- Returns:
true
if the operation was successful, otherwisefalse
.- Throws:
IOException
-
openUrl
Opens the given URL with the given browser. As of 0.9.38, the browser parameter will be parsed into arguments separated by spaces or tabs. %1, if present, will be replaced with the url. Arguments may be surrounded by single or double quotes if they contain spaces or tabs. There is no mechanism to escape quotes or other chars with backslashes. As of 0.9.46, fails immediately if JVM is a Windows or Linux Service. BLOCKING. However, this does NOT probe the server port to see if it is ready.- Parameters:
url
- The URL to open.browser
- The browser to use. See above for quoting rules.- Returns:
true
if the operation was successful, otherwisefalse
.- Throws:
IOException
-
startup
public void startup()ClientApp interface As of 0.9.46, stops immediately if JVM is a Windows or Linux Service. -
getState
ClientApp interface -
getName
ClientApp interface -
getDisplayName
ClientApp interface- Specified by:
getDisplayName
in interfaceClientApp
- Returns:
- non-null
- Since:
- 0.9.18
-
shutdown
ClientApp interface -
main
Obsolete, now uses ClientApp interface
-