Class HttpAPIClientHelper

java.lang.Object
com.clickhouse.client.api.internal.HttpAPIClientHelper

public class HttpAPIClientHelper extends Object
  • Constructor Details

    • HttpAPIClientHelper

      public HttpAPIClientHelper(Map<String,String> configuration, Object metricsRegistry, boolean initSslContext)
  • Method Details

    • createSSLContext

      public SSLContext createSSLContext()
      Creates or returns default SSL context.
      Returns:
      SSLContext
    • createHttpClient

      public org.apache.hc.client5.http.impl.classic.CloseableHttpClient createHttpClient(boolean initSslContext)
    • readError

      public Exception readError(org.apache.hc.core5.http.ClassicHttpResponse httpResponse)
      Reads status line and if error tries to parse response body to get server error message.
      Parameters:
      httpResponse - - HTTP response
      Returns:
    • executeRequest

      public org.apache.hc.core5.http.ClassicHttpResponse executeRequest(ClickHouseNode server, Map<String,Object> requestConfig, org.apache.hc.core5.io.IOCallback<OutputStream> writeCallback) throws IOException
      Throws:
      IOException
    • getHeaderInt

      public static int getHeaderInt(org.apache.hc.core5.http.Header header, int defaultValue)
    • getHeaderVal

      public static String getHeaderVal(org.apache.hc.core5.http.Header header, String defaultValue)
    • getHeaderVal

      public static <T> T getHeaderVal(org.apache.hc.core5.http.Header header, T defaultValue, Function<String,T> converter)
    • shouldRetry

      public boolean shouldRetry(Throwable ex, Map<String,Object> requestSettings)
    • wrapException

      public RuntimeException wrapException(String message, Exception cause)
    • parseUrlParameters

      public static Map<String,String> parseUrlParameters(URL url)
      Parses URL parameters.
      Parameters:
      url -
      Returns:
      Map of parameters
    • close

      public void close()