Class ProxyHelper


  • public class ProxyHelper
    extends Object
    Helper class for proxy setups.

    Code was based on Real Gagnon's example code located here.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Method Detail

      • isModified

        public boolean isModified()
        Whether the settings got modified.
        Returns:
        true if modified
      • getProxyType

        public Proxy.Type getProxyType()
        Returns the proxy type.
        Returns:
        the type
      • setProxyType

        public void setProxyType​(Proxy.Type value)
        Updates the proxy type.
        Parameters:
        value - the proxy type
      • getHost

        public String getHost​(Proxy.Type type)
        Returns the host.
        Parameters:
        type - the proxy type
        Returns:
        the host
      • setHost

        public void setHost​(Proxy.Type type,
                            String value)
        Sets the host.
        Parameters:
        type - the proxy type
        value - the host
      • getPort

        public int getPort​(Proxy.Type type)
        Returns the port.
        Parameters:
        type - the proxy type
        Returns:
        the port
      • setPort

        public void setPort​(Proxy.Type type,
                            int value)
        Sets the HTTP port.
        Parameters:
        type - the proxy type
        value - the port
      • getAuthentication

        public boolean getAuthentication​(Proxy.Type type)
        Returns whether authentication is necessary.
        Parameters:
        type - the proxy type
        Returns:
        true if authentication is necessary
      • setAuthentication

        public void setAuthentication​(Proxy.Type type,
                                      boolean value)
        Sets whether authentication is required for the proxy.
        Parameters:
        type - the proxy type
        value - if true then authentication is required
      • getUser

        public String getUser​(Proxy.Type type)
        Returns the proxy user.
        Parameters:
        type - the proxy type
        Returns:
        the user name
      • setUser

        public void setUser​(Proxy.Type type,
                            String value)
        Sets the proxy user.
        Parameters:
        type - the proxy type
        value - the user
      • getPassword

        public BasePassword getPassword​(Proxy.Type type)
        Returns the proxy password.
        Parameters:
        type - the proxy type
        Returns:
        the password
      • setPassword

        public void setPassword​(Proxy.Type type,
                                BasePassword value)
        Sets the proxy password.
        Parameters:
        type - the proxy type
        value - the password
      • getNoProxy

        public String[] getNoProxy​(Proxy.Type type)
        Returns the hosts that bypass the proxy.
        Parameters:
        type - the proxy type
        Returns:
        the hosts
      • setNoProxy

        public void setNoProxy​(Proxy.Type type,
                               String[] value)
        Sets the hosts that bypass the proxy.
        Parameters:
        type - the proxy type
        value - the hosts
      • reload

        public void reload()
        Reloads the properties file. Discards any unsaved settings.
      • save

        public boolean save()
        Saves the settings in the user's home directory.
        Returns:
        true if successfully saved
      • getSingleton

        public static ProxyHelper getSingleton()
        Returns the singleton.
        Returns:
        the singleton
      • main

        public static void main​(String[] args)
        For testing only.
        Parameters:
        args - ignored