edu.stanford.ejalbert.launching
Interface IBrowserLaunching

All Known Implementing Classes:
MacOs2_1BrowserLaunching, MacOsBrowserLaunching, UnixNetscapeBrowserLaunching, WindowsBrowserLaunching

public interface IBrowserLaunching

Main interface to the Browser Launching methods.

Author:
Markus Gebhard

Field Summary
static String BROWSER_DEFAULT
          Identifier for the system's default browser.
static String BROWSER_SYSTEM_PROPERTY
          Key to system property containing name of users preferred browser.
static String PROP_KEY_BROWSER_PREFIX
          prefix used for property file keys that define a browser
static String PROP_KEY_DELIMITER
          property file key for delimiter character used in other properties.
static String PROTOCOL_FILE
          file protocol
static String PROTOCOL_HTTP
          http protocol
static String PROTOCOL_MAILTO
          mailto protocol
 
Method Summary
 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(List browsers, String urlString)
          Allows user to target several browsers.
 void openUrl(String urlString)
          Opens the passed url in the system's default browser.
 void openUrl(String browser, 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

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

See Also:
Constant Field Values

PROP_KEY_DELIMITER

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

See Also:
Constant Field Values

PROP_KEY_BROWSER_PREFIX

public static final String PROP_KEY_BROWSER_PREFIX
prefix used for property file keys that define a browser

See Also:
Constant Field Values

PROTOCOL_HTTP

public static final String PROTOCOL_HTTP
http protocol

See Also:
Constant Field Values

PROTOCOL_FILE

public static final String PROTOCOL_FILE
file protocol

See Also:
Constant Field Values

PROTOCOL_MAILTO

public static final String PROTOCOL_MAILTO
mailto protocol

See Also:
Constant Field Values

BROWSER_DEFAULT

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

See Also:
Constant Field Values
Method Detail

initialize

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

Throws:
BrowserLaunchingInitializingException

openUrl

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

Parameters:
urlString - String
Throws:
UnsupportedOperatingSystemException
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException

openUrl

public void openUrl(String browser,
                    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

public void openUrl(List browsers,
                    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

public 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

public 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

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

Parameters:
forceNewWindow - boolean