edu.stanford.ejalbert.launching
Interface IBrowserLaunching

All Known Implementing Classes:
MacOs2_0BrowserLaunching, MacOs2_1BrowserLaunching, MacOs3_0BrowserLaunching, MacOs3_1BrowserLaunching, MacOsBrowserLaunching, SoyLatteBrowserLaunching, SunOSBrowserLaunching, UnixNetscapeBrowserLaunching, WindowsBrowserLaunching

public interface IBrowserLaunching

Main interface to the Browser Launching methods.


Field Summary
static java.lang.String BROWSER_DEFAULT
          Identifier for the system's default browser.
static java.lang.String BROWSER_SYSTEM_PROPERTY
          Key to system property containing name of users preferred browser.
static java.lang.String PROP_KEY_BROWSER_PREFIX
          prefix used for property file keys that define a browser
static java.lang.String PROP_KEY_DELIMITER
          property file key for delimiter character used in other properties.
static java.lang.String PROTOCOL_FILE
          file protocol
static java.lang.String PROTOCOL_HTTP
          http protocol
static java.lang.String PROTOCOL_MAILTO
          mailto protocol
static java.lang.String WINDOWS_BROWSER_DISC_POLICY_DISK
          Value associated with WINDOWS_BROWSER_DISC_POLICY_PROPERTY.
static java.lang.String WINDOWS_BROWSER_DISC_POLICY_PROPERTY
          Key to system property that controls how browsers are discovered when running on a Windows O/S.
static java.lang.String WINDOWS_BROWSER_DISC_POLICY_REGISTRY
          Value associated with WINDOWS_BROWSER_DISC_POLICY_PROPERTY.
 
Method Summary
 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()
          Performs any initialization needed for the particular O/S.
 void openUrl(java.util.List browsers, java.lang.String urlString)
          Allows user to target several browsers.
 void openUrl(java.lang.String urlString)
          Opens the passed url in the system's default browser.
 void openUrl(java.lang.String browser, java.lang.String urlString)
          Allows user to target a specific browser.
 void setNewWindowPolicy(boolean forceNewWindow)
          Sets the policy used for opening a url in a browser.
 

Field Detail

BROWSER_SYSTEM_PROPERTY

static final java.lang.String BROWSER_SYSTEM_PROPERTY
Key to system property containing name of users preferred browser.

See Also:
Constant Field Values

WINDOWS_BROWSER_DISC_POLICY_PROPERTY

static final java.lang.String WINDOWS_BROWSER_DISC_POLICY_PROPERTY
Key to system property that controls how browsers are discovered when running on a Windows O/S.

The values are registry and disk.

See Also:
Constant Field Values

WINDOWS_BROWSER_DISC_POLICY_DISK

static final java.lang.String WINDOWS_BROWSER_DISC_POLICY_DISK
Value associated with WINDOWS_BROWSER_DISC_POLICY_PROPERTY.

See Also:
Constant Field Values

WINDOWS_BROWSER_DISC_POLICY_REGISTRY

static final java.lang.String WINDOWS_BROWSER_DISC_POLICY_REGISTRY
Value associated with WINDOWS_BROWSER_DISC_POLICY_PROPERTY.

See Also:
Constant Field Values

PROP_KEY_DELIMITER

static final java.lang.String PROP_KEY_DELIMITER
property file key for delimiter character used in other properties.

See Also:
Constant Field Values

PROP_KEY_BROWSER_PREFIX

static final java.lang.String PROP_KEY_BROWSER_PREFIX
prefix used for property file keys that define a browser

See Also:
Constant Field Values

PROTOCOL_HTTP

static final java.lang.String PROTOCOL_HTTP
http protocol

See Also:
Constant Field Values

PROTOCOL_FILE

static final java.lang.String PROTOCOL_FILE
file protocol

See Also:
Constant Field Values

PROTOCOL_MAILTO

static final java.lang.String PROTOCOL_MAILTO
mailto protocol

See Also:
Constant Field Values

BROWSER_DEFAULT

static final java.lang.String BROWSER_DEFAULT
Identifier for the system's default browser.

See Also:
Constant Field Values
Method Detail

initialize

void initialize()
                throws BrowserLaunchingInitializingException
Performs any initialization needed for the particular O/S.

Throws:
BrowserLaunchingInitializingException

openUrl

void openUrl(java.lang.String urlString)
             throws UnsupportedOperatingSystemException,
                    BrowserLaunchingExecutionException,
                    BrowserLaunchingInitializingException
Opens the passed url in the system's default browser.

Parameters:
urlString - String
Throws:
UnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException

openUrl

void openUrl(java.lang.String browser,
             java.lang.String urlString)
             throws UnsupportedOperatingSystemException,
                    BrowserLaunchingExecutionException,
                    BrowserLaunchingInitializingException
Allows user to target a specific browser. The names of potential browsers can be accessed via the getBrowserList method.

If the call to the requested browser fails, the code will fail over to the default browser.

Parameters:
browser - String
urlString - String
Throws:
UnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException

openUrl

void openUrl(java.util.List browsers,
             java.lang.String urlString)
             throws UnsupportedOperatingSystemException,
                    BrowserLaunchingExecutionException,
                    BrowserLaunchingInitializingException
Allows user to target several browsers. The names of potential browsers can be accessed via the 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.

Parameters:
browsers - List
urlString - String
Throws:
UnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException

getBrowserList

java.util.List getBrowserList()
Returns a list of browsers to be used for browser targetting. This list will always contain at least one item: BROWSER_DEFAULT.

Returns:
List

getNewWindowPolicy

boolean getNewWindowPolicy()
Returns the policy used for opening a url in a browser.

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.

Results will vary based on the O/S and browser being targetted.

Returns:
boolean

setNewWindowPolicy

void setNewWindowPolicy(boolean forceNewWindow)
Sets the policy used for opening a url in a browser.

Parameters:
forceNewWindow - boolean