IBrowserLaunching
public class WindowsBrowserLaunching extends java.lang.Object implements IBrowserLaunching
Modifier and Type | Field | Description |
---|---|---|
protected AbstractLogger |
logger |
|
static java.lang.String |
WINKEY_WIN2000 |
config file key for Windows 2000
|
static java.lang.String |
WINKEY_WIN9X |
config file key for Windows 9x
|
static java.lang.String |
WINKEY_WINNT |
config file key for Windows NT
|
static java.lang.String |
WINKEY_WINVISTA |
config file key for Windows Vista
|
BROWSER_DEFAULT, BROWSER_SYSTEM_PROPERTY, PROP_KEY_BROWSER_PREFIX, PROP_KEY_DELIMITER, PROTOCOL_FILE, PROTOCOL_HTTP, PROTOCOL_MAILTO, WINDOWS_BROWSER_DISC_POLICY_DISK, WINDOWS_BROWSER_DISC_POLICY_PROPERTY, WINDOWS_BROWSER_DISC_POLICY_REGISTRY
Constructor | Description |
---|---|
WindowsBrowserLaunching(AbstractLogger logger,
java.lang.String windowsKey) |
Checks that the windows key is valid.
|
Modifier and Type | Method | Description |
---|---|---|
java.util.List |
getBrowserList() |
Returns a list of browsers to be used for browser targetting.
|
boolean |
getNewWindowPolicy() |
Returns the policy used for opening a url in a browser.
|
void |
initialize() |
Initializes the browser launcher from the windows config
file.
|
void |
openUrl(java.lang.String urlString) |
Opens a url using the default browser.
|
void |
openUrl(java.lang.String browser,
java.lang.String urlString) |
Opens a url using a specific browser.
|
void |
openUrl(java.util.List browsers,
java.lang.String urlString) |
Allows user to target several browsers.
|
void |
setNewWindowPolicy(boolean forceNewWindow) |
Sets the policy used for opening a url in a browser.
|
public static final java.lang.String WINKEY_WINVISTA
public static final java.lang.String WINKEY_WIN2000
public static final java.lang.String WINKEY_WIN9X
public static final java.lang.String WINKEY_WINNT
protected final AbstractLogger logger
public WindowsBrowserLaunching(AbstractLogger logger, java.lang.String windowsKey)
logger
- AbstractLoggerwindowsKey
- Stringpublic void initialize() throws BrowserLaunchingInitializingException
initialize
in interface IBrowserLaunching
BrowserLaunchingInitializingException
windowsKey
public void openUrl(java.lang.String urlString) throws UnsupportedOperatingSystemException, BrowserLaunchingExecutionException, BrowserLaunchingInitializingException
openUrl
in interface IBrowserLaunching
urlString
- StringUnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException
public void openUrl(java.lang.String browser, java.lang.String urlString) throws UnsupportedOperatingSystemException, BrowserLaunchingExecutionException, BrowserLaunchingInitializingException
If the specified browser is not available, the method will fall through to calling the default openUrl method.
openUrl
in interface IBrowserLaunching
browser
- StringurlString
- StringUnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException
public void openUrl(java.util.List browsers, java.lang.String urlString) throws UnsupportedOperatingSystemException, BrowserLaunchingExecutionException, BrowserLaunchingInitializingException
getBrowserList
method.
The browsers from the list will be tried in order (first to last) until one of the calls succeeds. If all the calls to the requested browsers fail, the code will fail over to the default browser.
openUrl
in interface IBrowserLaunching
browsers
- ListurlString
- StringUnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException
public java.util.List getBrowserList()
getBrowserList
in interface IBrowserLaunching
public boolean getNewWindowPolicy()
If the policy is true, an attempt will be made to force the url to be opened in a new instance (window) of the browser.
If the policy is false, the url may open in a new window or a new tab.
Some browsers on Windows systems have command line options to support this feature.
getNewWindowPolicy
in interface IBrowserLaunching
public void setNewWindowPolicy(boolean forceNewWindow)
setNewWindowPolicy
in interface IBrowserLaunching
forceNewWindow
- boolean