Class ProxySettings

  • All Implemented Interfaces:
    IXMLConfigurable, Serializable

    public class ProxySettings
    extends Object
    implements IXMLConfigurable, Serializable

    Convenience class for implementation requiring proxy settings.

    Password encryption:

    Passwords can be encrypted using EncryptionUtil (or command-line "encrypt.bat" or "encrypt.sh" if those are available to you). In order for the password to be decrypted properly, you need to specify the encryption key used to encrypt it. The key can obtained from a few supported locations. The combination of the password key "value" and "source" is used to properly locate the key. The supported sources are:

    key The actual encryption key.
    file Path to a file containing the encryption key.
    environment Name of an environment variable containing the key.
    property Name of a JVM system property containing the key.

    XML configuration usage:

    
    <host>
      <name>(host name)</name>
      <port>(host port)</port>
    </host>
    <scheme>(Default is "http")</scheme>
    <realm>(Authentication realm. Default is any.)</realm>
    <credentials>
      <username>(the username)</username>
      <password>(the optionally encrypted password)</password>
      <passwordKey>
        <value>(The actual password encryption key or a reference to it.)</value>
        <source>[key|file|environment|property]</source>
        <size>(Size in bits of encryption key. Default is 128.)</size>
      </passwordKey>
    </credentials>

    The above can be found under any parent tag. See consuming class documentation for exact usage.

    Since:
    1.14.0
    Author:
    Pascal Essiembre
    See Also:
    Serialized Form
    • Constructor Detail

      • ProxySettings

        public ProxySettings()
      • ProxySettings

        public ProxySettings​(String name,
                             int port)
      • ProxySettings

        public ProxySettings​(Host host)
    • Method Detail

      • getHost

        public Host getHost()
        Gets the proxy host.
        Returns:
        proxy host or null if not set
        See Also:
        isSet()
      • setHost

        public ProxySettings setHost​(Host host)
        Sets the proxy host.
        Parameters:
        host - proxy host
        Returns:
        this
      • getScheme

        public String getScheme()
        Gets the proxy scheme.
        Returns:
        proxy scheme
        Since:
        2.0.0
      • setScheme

        public ProxySettings setScheme​(String scheme)
        Sets the proxy scheme.
        Parameters:
        scheme - proxy scheme
        Returns:
        this
        Since:
        2.0.0
      • getCredentials

        public Credentials getCredentials()
        Gets the proxy credentials.
        Returns:
        proxy credentials (never null)
        Since:
        2.0.0
      • setCredentials

        public ProxySettings setCredentials​(Credentials credentials)
        Sets the proxy credentials.
        Parameters:
        credentials - proxy credentials
        Returns:
        this
        Since:
        2.0.0
      • getRealm

        public String getRealm()
        Gets the proxy realm.
        Returns:
        proxy realm
        Since:
        2.0.0
      • setRealm

        public ProxySettings setRealm​(String realm)
        Sets the proxy realm.
        Parameters:
        realm - proxy realm
        Returns:
        this
        Since:
        2.0.0
      • getProxyHost

        @Deprecated
        public String getProxyHost()
        Deprecated.
        Since 2.0.0, use getHost().
        Gets the proxy host.
        Returns:
        proxy host
      • getProxyPort

        @Deprecated
        public int getProxyPort()
        Deprecated.
        Since 2.0.0, use getHost().
        Gets the proxy port.
        Returns:
        proxy port
      • setProxyPort

        @Deprecated
        public ProxySettings setProxyPort​(int proxyPort)
        Deprecated.
        Since 2.0.0, use setHost(Host).
        Sets proxy port.
        Parameters:
        proxyPort - proxy port
        Returns:
        this
      • getProxyScheme

        @Deprecated
        public String getProxyScheme()
        Deprecated.
        Since 2.0.0, use getScheme().
        Gets the proxy scheme.
        Returns:
        proxy scheme
      • getProxyRealm

        @Deprecated
        public String getProxyRealm()
        Deprecated.
        Since 2.0.0, use getRealm().
        Gets proxy realm.
        Returns:
        proxy realm
      • isSet

        public boolean isSet()
      • loadFromXML

        public void loadFromXML​(XML xml)
        Description copied from interface: IXMLConfigurable
        Load XML configuration values and initialized this object with them.
        Specified by:
        loadFromXML in interface IXMLConfigurable
        Parameters:
        xml - the XML to load into this object
      • saveToXML

        public void saveToXML​(XML xml)
        Description copied from interface: IXMLConfigurable
        Saves this object as XML.
        Specified by:
        saveToXML in interface IXMLConfigurable
        Parameters:
        xml - the XML that will representing this object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object