Class ProxySettings

  • All Implemented Interfaces:
    Configuration

    public class ProxySettings
    extends java.lang.Object
    implements Configuration
    Utility class for handling proxy connection settings.
    • Field Detail

      • PROPNAME_PROXIES_ENABLED

        private static final java.lang.String PROPNAME_PROXIES_ENABLED
        See Also:
        Constant Field Values
      • PROPNAME_PROXIES_NONPROXYHOSTS_STARTING

        private static final java.lang.String PROPNAME_PROXIES_NONPROXYHOSTS_STARTING
        See Also:
        Constant Field Values
      • PROPNAME_HTTP_PROXYHOST

        private static final java.lang.String PROPNAME_HTTP_PROXYHOST
        See Also:
        Constant Field Values
      • PROPNAME_HTTP_PROXYPORT

        private static final java.lang.String PROPNAME_HTTP_PROXYPORT
        See Also:
        Constant Field Values
      • PROPNAME_HTTPS_PROXYHOST

        private static final java.lang.String PROPNAME_HTTPS_PROXYHOST
        See Also:
        Constant Field Values
      • PROPNAME_HTTPS_PROXYPORT

        private static final java.lang.String PROPNAME_HTTPS_PROXYPORT
        See Also:
        Constant Field Values
      • PROPNAME_FTP_PROXYHOST

        private static final java.lang.String PROPNAME_FTP_PROXYHOST
        See Also:
        Constant Field Values
      • PROPNAME_FTP_PROXYPORT

        private static final java.lang.String PROPNAME_FTP_PROXYPORT
        See Also:
        Constant Field Values
      • PROPNAME_SOCKS_PROXYHOST

        private static final java.lang.String PROPNAME_SOCKS_PROXYHOST
        See Also:
        Constant Field Values
      • PROPNAME_SOCKS_PROXYPORT

        private static final java.lang.String PROPNAME_SOCKS_PROXYPORT
        See Also:
        Constant Field Values
      • props

        private java.util.Properties props
      • PROXY_SETTINGS_FILENAME

        public static final java.lang.String PROXY_SETTINGS_FILENAME
        See Also:
        Constant Field Values
      • confDir

        private final java.io.File confDir
      • propsFile

        private java.io.File propsFile
    • Constructor Detail

      • ProxySettings

        public ProxySettings​(java.io.File applicationDataDir)
                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.String val)
      • setSystemProperty

        private void setSystemProperty​(java.lang.String key,
                                       java.lang.String val)
      • getProxiesEnabled

        public boolean getProxiesEnabled()
      • setProxiesEnabled

        public void setProxiesEnabled​(boolean proxiesEnabled)
        Parameters:
        proxiesEnabled -
      • getHttpProxyHost

        public java.lang.String getHttpProxyHost()
        Returns:
        proxy
      • setHttpProxyHost

        public void setHttpProxyHost​(java.lang.String httpProxyHost)
        Parameters:
        httpProxyHost -
      • getHttpProxyPort

        public java.lang.String getHttpProxyPort()
        Get HTTP proxy port as string
        Returns:
        proxy port
      • setHttpProxyPort

        public void setHttpProxyPort​(java.lang.String httpProxyPort)
        Set HTTP proxy port
        Parameters:
        httpProxyPort - proxy port
      • getHttpsProxyHost

        public java.lang.String getHttpsProxyHost()
        Get HTTPS proxy host
        Returns:
        proxy host as string
      • setHttpsProxyHost

        public void setHttpsProxyHost​(java.lang.String httpsProxyHost)
        Get HTTPS proxy host
        Parameters:
        httpsProxyHost -
      • getHttpsProxyPort

        public java.lang.String getHttpsProxyPort()
      • setHttpsProxyPort

        public void setHttpsProxyPort​(java.lang.String httpsProxyPort)
      • getFtpProxyHost

        public java.lang.String getFtpProxyHost()
      • setFtpProxyHost

        public void setFtpProxyHost​(java.lang.String ftpProxyHost)
      • getFtpProxyPort

        public java.lang.String getFtpProxyPort()
      • setFtpProxyPort

        public void setFtpProxyPort​(java.lang.String ftpProxyPort)
      • getSocksProxyHost

        public java.lang.String getSocksProxyHost()
      • setSocksProxyHost

        public void setSocksProxyHost​(java.lang.String socksProxyHost)
      • getSocksProxyPort

        public java.lang.String getSocksProxyPort()
      • setSocksProxyPort

        public void setSocksProxyPort​(java.lang.String socksProxyPort)
      • setProxySystemProperty

        private void setProxySystemProperty​(java.lang.String key,
                                            java.lang.String val)
      • getNonProxyHostsStarting

        public java.lang.String getNonProxyHostsStarting()
        Get the semicolon-separated list of hostnames starting with given strings, that do not use the proxy settings.
      • setNonProxyHostsStarting

        public void setNonProxyHostsStarting​(java.lang.String nonProxyHostsStarting)
        Set the semicolon separated list of hostnames starting with given strings, that do not use the proxy settings.
      • load

        public void load()
                  throws java.io.IOException
        (Re-)loads the proxy system properties.
        Specified by:
        load in interface Configuration
        Throws:
        java.io.IOException - if the configuration settings could not be loaded due to an I/O problem.
      • save

        public void save()
                  throws java.io.IOException
        Saves the currently known settings.
        Specified by:
        save in interface Configuration
        Throws:
        java.io.IOException - if the configuration settings could not be saved due to an I/O problem.
      • destroy

        public void destroy()
                     throws java.io.IOException
        Description copied from interface: Configuration
        Clean up configuration resources.
        Specified by:
        destroy in interface Configuration
        Throws:
        java.io.IOException - if one or more resources could not be cleaned up. Implementations should attempt to clean up as many resources as possible before returning or throwing an exception.
      • init

        public void init()
                  throws java.io.IOException
        Description copied from interface: Configuration
        Initialize the configuration settings.
        Specified by:
        init in interface Configuration
        Throws:
        java.io.IOException - if the configuration settings could not be initialized because of an I/O problem.