edu.stanford.ejalbert.launching.windows
Class Windows9xBrowserLaunching

java.lang.Object
  extended byedu.stanford.ejalbert.launching.windows.WindowsBrowserLaunching
      extended byedu.stanford.ejalbert.launching.windows.DefaultWindowsBrowserLaunching
          extended byedu.stanford.ejalbert.launching.windows.Windows9xBrowserLaunching
All Implemented Interfaces:
IBrowserLaunching

public class Windows9xBrowserLaunching
extends DefaultWindowsBrowserLaunching

Author:
Markus Gebhard

Field Summary
protected static String FIRST_WINDOWS_PARAMETER
          The first parameter that needs to be passed into Runtime.exec() to open the default web browser on Windows.
protected static String SECOND_WINDOWS_PARAMETER
          The second parameter for Runtime.exec() on Windows.
protected static String THIRD_WINDOWS_PARAMETER
          The third parameter for Runtime.exec() on Windows.
 
Fields inherited from class edu.stanford.ejalbert.launching.windows.WindowsBrowserLaunching
logger
 
Fields inherited from interface edu.stanford.ejalbert.launching.IBrowserLaunching
BROWSER_DEFAULT, PROTOCOL_FILE, PROTOCOL_HTTP, PROTOCOL_MAILTO
 
Constructor Summary
Windows9xBrowserLaunching(AbstractLogger logger)
           
 
Method Summary
protected  Map getAvailableBrowsers(List browsersToCheck)
          Accesses the Windows registry to look for browser exes.
 List getBrowserList()
          Returns a list of browsers to be used for browser targetting.
protected  Map getBrowserMap()
          Returns map of browser names and exe names to WindowsBrowser objects.
protected  String[] getCommandArgs(String protocol, String urlString)
          Command args for Windows 9x type.
protected  String[] getCommandArgs(String protocol, String browserName, String urlString)
          Command args for Windows 9x type.
 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.
 
Methods inherited from class edu.stanford.ejalbert.launching.windows.WindowsBrowserLaunching
getArrayAsString, getProtocol, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST_WINDOWS_PARAMETER

protected static final String FIRST_WINDOWS_PARAMETER
The first parameter that needs to be passed into Runtime.exec() to open the default web browser on Windows.

See Also:
Constant Field Values

SECOND_WINDOWS_PARAMETER

protected static final String SECOND_WINDOWS_PARAMETER
The second parameter for Runtime.exec() on Windows.

See Also:
Constant Field Values

THIRD_WINDOWS_PARAMETER

protected static final String THIRD_WINDOWS_PARAMETER
The third parameter for Runtime.exec() on Windows. This is a "title" parameter that the command line expects. Setting this parameter allows URLs containing spaces to work.

See Also:
Constant Field Values
Constructor Detail

Windows9xBrowserLaunching

public Windows9xBrowserLaunching(AbstractLogger logger)
Method Detail

getCommandArgs

protected String[] getCommandArgs(String protocol,
                                  String urlString)
Command args for Windows 9x type.

Specified by:
getCommandArgs in class DefaultWindowsBrowserLaunching
Parameters:
protocol - String
urlString - String
Returns:
String[]

getCommandArgs

protected String[] getCommandArgs(String protocol,
                                  String browserName,
                                  String urlString)
Command args for Windows 9x type.

Specified by:
getCommandArgs in class DefaultWindowsBrowserLaunching
Parameters:
protocol - String
browserName - String
urlString - String
Returns:
String[]

getAvailableBrowsers

protected Map getAvailableBrowsers(List browsersToCheck)
Accesses the Windows registry to look for browser exes. The browsers search for are in the browsersToCheck list. The returned map will use display names and exe names as keys to the WindowsBrowser objects.

Parameters:
browsersToCheck - List
Returns:
Map

getBrowserMap

protected final Map getBrowserMap()
Returns map of browser names and exe names to WindowsBrowser objects.

This is the preferred method for accessing the browser name and exe map.

Returns:
Map

openUrl

public void openUrl(String urlString)
             throws UnsupportedOperatingSystemException,
                    BrowserLaunchingExecutionException,
                    BrowserLaunchingInitializingException
Description copied from interface: IBrowserLaunching
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
Description copied from interface: IBrowserLaunching
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:
BrowserLaunchingExecutionException
BrowserLaunchingInitializingException
UnsupportedOperatingSystemException

getBrowserList

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

Returns:
List