Class KdeProxySearchStrategy

  • All Implemented Interfaces:
    ProxySearchStrategy

    public class KdeProxySearchStrategy
    extends java.lang.Object
    implements ProxySearchStrategy
    Loads the KDE4 proxy settings from the KDE kioslaverc file. This will load properties from the file

    .kde/share/config/kioslaverc

    starting from the current users home directory.

    The following settings are extracted from the section "[Proxy Settings]":

    • AuthMode -> 0 = no auth., 1 = use login.
    • ProxyType -> 0 = direct 1 = use fixed settings, 2 = use PAC, 3 = automatic (WPAD) , 4 = Use environment variables?
    • Proxy Config Script -> URL to PAC file
    • ftpProxy -> Fixed ftp proxy address e.g. http://www.ftp-proxy.com:8080
    • httpProxy -> Fixed http proxy e.g http://www.http-proxy.com:8080
    • httpsProxy -> Fixed https proxy e.g http://www.https-proxy.com:8080
    • NoProxyFor -> Proxy white list
    • ReversedException -> false = use NoProxyFor, true = revert meaning of the NoProxyFor list
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Gets the printable name of the search strategy.
      java.net.ProxySelector getProxySelector()
      Loads the proxy settings and initializes a proxy selector for the firefox proxy settings.
      private java.util.Properties readSettings()
      Reads the settings and stores them in a properties map.
      private java.net.ProxySelector setupEnvVarSelector​(java.util.Properties settings)
      Builds an environment variable selector.
      private java.net.ProxySelector setupFixedProxySelector​(java.util.Properties settings)
      Parse the fixed proxy settings and build an ProxySelector for this a chained configuration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KdeProxySearchStrategy

        public KdeProxySearchStrategy()
        ProxySelector using the given parser.
        See Also:
        ProxySelector()
      • KdeProxySearchStrategy

        public KdeProxySearchStrategy​(KdeSettingsParser settingsParser)
        ProxySelector
        Parameters:
        settingsParser - the KdeSettingsParser instance to use.
        See Also:
        ProxySelector()
    • Method Detail

      • getProxySelector

        public java.net.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 java.lang.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

        private java.util.Properties readSettings()
                                           throws ProxyException
        Reads the settings and stores them in a properties map.
        Returns:
        the parsed settings.
        Throws:
        ProxyException
      • setupEnvVarSelector

        private java.net.ProxySelector setupEnvVarSelector​(java.util.Properties settings)
        Builds an environment variable selector.
        Parameters:
        settings - the settings to read from.
        Returns:
        the ProxySelector using environment variables.
      • setupFixedProxySelector

        private java.net.ProxySelector setupFixedProxySelector​(java.util.Properties settings)
        Parse the fixed proxy settings and build an ProxySelector for this a chained configuration.
        Parameters:
        settings - the proxy settings to evaluate.