Class FirefoxProxySearchStrategy

java.lang.Object
com.github.markusbernhardt.proxy.search.browser.firefox.FirefoxProxySearchStrategy
All Implemented Interfaces:
ProxySearchStrategy

public class FirefoxProxySearchStrategy extends Object implements ProxySearchStrategy
Loads the Firefox3 proxy settings from the users Firefox3 settings. This will load the file prefs.js that is located in the

.mozilla/firefox/(profile)/ folder.

See Mozilla_Networking_Preferences for an explanation of the proxy settings.

The following settings are extracted from this file:

Some generic settings:
  • network.proxy.type -> n/a = use system settings, 0 = direct, 1 = Fixed proxy settings, 2 = proxy script (PAC), 3 = also direct , 4 = auto detect (WPAD)
  • network.proxy.share_proxy_settings -> true = use same proxy for all protocols
  • network.proxy.no_proxies_on -> a comma separated ignore list.
  • network.proxy.autoconfig_url -> a URL to an proxy configuration script
Host names and ports per protocol are stored in the following settings:
  • network.proxy.http
  • network.proxy.http_port
  • network.proxy.ssl
  • network.proxy.ssl_port
  • network.proxy.ftp
  • network.proxy.ftp_port
  • network.proxy.gopher
  • network.proxy.gopher_port
  • network.proxy.socks
  • network.proxy.socks_port
  • network.proxy.socks_version -> 4 or 5

Note that if there are more than one profile the first profile found will be used.

Author:
Markus Bernhardt, Copyright 2016, Bernd Rosstauscher, Copyright 2009
  • Constructor Details

    • FirefoxProxySearchStrategy

      public FirefoxProxySearchStrategy()
      ProxySelector
      See Also:
  • Method Details

    • getProxySelector

      public ProxySelector getProxySelector() throws ProxyException
      Loads the proxy settings and initializes a proxy selector for the firefox proxy settings.
      Specified by:
      getProxySelector in interface ProxySearchStrategy
      Returns:
      a configured ProxySelector, null if none is found.
      Throws:
      ProxyException - on file reading error.
    • getName

      public String getName()
      Gets the printable name of the search strategy.
      Specified by:
      getName in interface ProxySearchStrategy
      Returns:
      the printable name of the search strategy
    • readSettings

      public Properties readSettings() throws ProxyException
      Reads the settings file and stores all settings in a Properties map.
      Returns:
      the parsed settings.
      Throws:
      ProxyException - on read error.