Class HttpProxy

All Implemented Interfaces:
ConfigurationObject

public final class HttpProxy extends HttpCredential
This configuration object configures the proxies to be used by the system. This is configured as one of the root elements of the config.yaml

Example - Proxy all requests except localhost and www.camptocamp.org:


 proxies:
   - !proxy
     scheme: http
     host: proxy.host.com
     port: 8888
     username: username
     password: xyzpassword
     matchers:
       - !localMatch
         reject: true
       - !dnsMatch
         host: www.camptocamp.org
         reject: true
       - !acceptAll {}
 
  • Constructor Details

    • HttpProxy

      public HttpProxy()
  • Method Details

    • getHttpHost

      public org.apache.http.HttpHost getHttpHost()
    • setScheme

      public void setScheme(String scheme)
      The scheme (http, https) of the proxy.

      This is optional, default is http if no username and https if there is a password

      Parameters:
      scheme - the scheme of the proxy
    • setMatchers

      public void setMatchers(List<? extends URIMatcher> matchers)
      Matchers are used to choose which requests this proxy applies to.
      Overrides:
      setMatchers in class HttpCredential
      Parameters:
      matchers - the matchers to use to determine which requests the applies can be used for
      See Also:
    • setHost

      public void setHost(String host)
      The host of the proxy. Can be a hostname or ip address.

      This is required.

      Parameters:
      host - the host of the proxy
    • setUsername

      public void setUsername(String username)
      The username for authenticating with the proxy.

      This is optional

      Overrides:
      setUsername in class HttpCredential
      Parameters:
      username - the username for authenticating with the proxy
    • setPassword

      public void setPassword(String password)
      The password for authenticating with the proxy.

      This is optional

      Overrides:
      setPassword in class HttpCredential
      Parameters:
      password - the password for authenticating with the proxy
    • setPort

      public void setPort(int port)
      The host of the proxy. Can be a hostname or ip address.

      This is optional. The default value is 80.

      Parameters:
      port - the port of the proxy
    • validate

      public void validate(List<Throwable> validationErrors, Configuration configuration)
      Description copied from interface: ConfigurationObject
      validate that the configuration was correct.
      Specified by:
      validate in interface ConfigurationObject
      Overrides:
      validate in class HttpCredential
      Parameters:
      validationErrors - a list to add any detected errors to.
      configuration - the containing configuration