Class ProxySettings

java.lang.Object
com.norconex.commons.lang.net.ProxySettings
All Implemented Interfaces:
Serializable

public class ProxySettings extends Object implements Serializable

Convenience class for implementation requiring proxy settings.

Since:
1.14.0
See Also:
  • Constructor Details

    • ProxySettings

      public ProxySettings()
    • ProxySettings

      public ProxySettings(String name, int port)
    • ProxySettings

      public ProxySettings(Host host)
  • Method Details

    • setCredentials

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

      public boolean isSet()
      Wether this proxy is configured. That is, if the host is not null and also configured.
      Returns:
      true if set
      See Also:
    • copyTo

      public void copyTo(ProxySettings another)
      Copy properties of this instance to the supplied instance.
      Parameters:
      another - another proxy settings instance
    • copyFrom

      public void copyFrom(ProxySettings another)
      Copy properties of the supplied instance to this instance.
      Parameters:
      another - another proxy settings instance
    • toProxy

      public Proxy toProxy()
      Converts this proxy settings to a Proxy. The scheme is used to establish the proxy type. If isSet() returns false, this method returns null.
      Returns:
      proxy or null
      Since:
      3.0.0
    • getHost

      public Host getHost()
      Proxy host (name and port), or null when not set.
    • getScheme

      public String getScheme()
      Proxy scheme (default is "http").
      Since:
      2.0.0
    • getCredentials

      public Credentials getCredentials()
      Proxy credentials, when required or applicable. Never null.
      Since:
      2.0.0
    • getRealm

      public String getRealm()
      Proxy authentication realm, when required or applicable.
      Since:
      2.0.0
    • setHost

      public ProxySettings setHost(Host host)
      Proxy host (name and port), or null when not set.
      Returns:
      this.
    • setScheme

      public ProxySettings setScheme(String scheme)
      Proxy scheme (default is "http").
      Returns:
      this.
      Since:
      2.0.0
    • setRealm

      public ProxySettings setRealm(String realm)
      Proxy authentication realm, when required or applicable.
      Returns:
      this.
      Since:
      2.0.0
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object