Class ProxyHelper


  • public class ProxyHelper
    extends Object
    author: Pascal Knueppel
    created at: 09.12.2019 - 12:17

    this helper can be used with the apache http-client to create an http client that will use a proxy.
    See Also:
    ScimHttpClient
    • Constructor Detail

      • ProxyHelper

        public ProxyHelper​(String systemProxyHost,
                           int systemProxyPort,
                           String systemProxyUsername,
                           String systemProxyPassword)
    • Method Detail

      • isProxySet

        public boolean isProxySet()
        Returns:
        true if a proxy configuration is present, false else
      • getProxyCredentials

        public org.apache.http.client.CredentialsProvider getProxyCredentials()
        Returns:
        a basic credentials provider that will be used for proxy authentication.
      • getProxyConfig

        public org.apache.http.client.config.RequestConfig getProxyConfig()
        will give back a request-config with the proxy settings based on the configuration-poperties
        Returns:
        a new config with the configured proxy or the default-config
      • getProxyAddress

        public String getProxyAddress()
        Returns:
        the currently configured proxy settings as string in the form "localhost:8888"
      • getSystemProxyHost

        public String getSystemProxyHost()
        the host under which the proxy can be reached
      • getSystemProxyPort

        public int getSystemProxyPort()
        the port on the host under which the proxy can be reached
      • getSystemProxyUsername

        public String getSystemProxyUsername()
        optional proxy username in case of proxy authentication
      • getSystemProxyPassword

        public String getSystemProxyPassword()
        optional proxy password in case of proxy authentication
      • setSystemProxyHost

        public void setSystemProxyHost​(String systemProxyHost)
        the host under which the proxy can be reached
      • setSystemProxyPort

        public void setSystemProxyPort​(int systemProxyPort)
        the port on the host under which the proxy can be reached
      • setSystemProxyUsername

        public void setSystemProxyUsername​(String systemProxyUsername)
        optional proxy username in case of proxy authentication
      • setSystemProxyPassword

        public void setSystemProxyPassword​(String systemProxyPassword)
        optional proxy password in case of proxy authentication