Class HttpUtil


  • public class HttpUtil
    extends Object
    Created by hyu on 8/10/17.
    • Constructor Detail

      • HttpUtil

        public HttpUtil()
    • Method Detail

      • getHttpClient

        public static org.apache.http.impl.client.CloseableHttpClient getHttpClient​(String accountName)
        Returns:
        Instance of CloseableHttpClient
      • initHttpClient

        public static org.apache.http.impl.client.CloseableHttpClient initHttpClient​(boolean shouldBypassProxy)
        Initialize http client with default settings
        Parameters:
        shouldBypassProxy - - whether to bypass proxy
        Returns:
        CloseableHttpClient
      • generateProxyPropertiesForJDBC

        public static Properties generateProxyPropertiesForJDBC()
        Helper method to decide whether to add any properties related to proxy server. These properties are passed on to snowflake JDBC while calling put API.
        Returns:
        proxy parameters that could be used by JDBC
      • shutdownHttpConnectionManagerDaemonThread

        public static void shutdownHttpConnectionManagerDaemonThread()
        Shuts down the daemon thread.
      • shouldBypassProxy

        public static Boolean shouldBypassProxy​(String accountName)
        Changes the account name to the format accountName.snowflakecomputing.com then returns a boolean to indicate if we should go through a proxy or not.
      • isInNonProxyHosts

        public static Boolean isInNonProxyHosts​(String targetHost)
        The target hostname input is compared with the hosts in the '|' separated list provided by the http.nonProxyHosts parameter using regex. The nonProxyHosts will be used as our Patterns, so we need to replace the '.' and '*' characters since those are special regex constructs that mean 'any character,' and 'repeat 0 or more times.'