public class HttpUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpUtil.HttpInputStream |
| Modifier and Type | Field and Description |
|---|---|
static Map<HttpClientSettingsKey,org.apache.http.impl.client.CloseableHttpClient> |
httpClient
The unique httpClient shared by all connections.
|
static String |
JDBC_MAX_CONNECTIONS_PER_ROUTE_PROPERTY |
static String |
JDBC_MAX_CONNECTIONS_PROPERTY |
static String |
JDBC_TTL |
| Constructor and Description |
|---|
HttpUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeExpiredAndIdleConnections() |
static String |
executeGeneralRequest(org.apache.http.client.methods.HttpRequestBase httpRequest,
int retryTimeout,
HttpClientSettingsKey ocspAndProxyKey)
Executes a HTTP request for Snowflake.
|
static String |
executeRequest(org.apache.http.client.methods.HttpRequestBase httpRequest,
int retryTimeout,
int injectSocketTimeout,
AtomicBoolean canceling,
boolean includeRetryParameters,
boolean retryOnHTTP403,
HttpClientSettingsKey ocspAndProxyKey)
Executes a HTTP request for Snowflake.
|
static org.apache.http.client.config.RequestConfig |
getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs,
boolean withoutCookies)
Return a request configuration inheriting from the default request configuration of the shared
HttpClient with a different socket timeout.
|
static long |
getDownloadedConditionTimeoutInSeconds() |
static org.apache.http.impl.client.CloseableHttpClient |
getHttpClient(HttpClientSettingsKey ocspAndProxyKey)
Gets HttpClient with insecureMode false
|
static org.apache.http.impl.client.CloseableHttpClient |
getHttpClientWithoutDecompression(HttpClientSettingsKey ocspAndProxyKey)
Gets HttpClient with insecureMode false and disabling decompression
|
static org.apache.http.client.config.RequestConfig |
getRequestConfigWithoutCookies()
Return a request configuration inheriting from the default request configuration of the shared
HttpClient with the coopkie spec set to ignore.
|
static org.apache.http.impl.client.CloseableHttpClient |
initHttpClient(HttpClientSettingsKey key,
File ocspCacheFile)
Accessor for the HTTP client singleton.
|
static org.apache.http.impl.client.CloseableHttpClient |
initHttpClientWithoutDecompression(HttpClientSettingsKey key,
File ocspCacheFile)
Accessor for the HTTP client singleton.
|
static boolean |
isSocksProxyDisabled()
Returns whether the SOCKS proxy is disabled for this JVM
|
static void |
setProxyForAzure(HttpClientSettingsKey key,
com.microsoft.azure.storage.OperationContext opContext)
A static function to set Azure proxy params when there is a valid session
|
static void |
setProxyForS3(HttpClientSettingsKey key,
com.amazonaws.ClientConfiguration clientConfig)
A static function to set S3 proxy params when there is a valid session
|
static void |
setRequestConfig(org.apache.http.client.config.RequestConfig requestConfig) |
static void |
setSessionlessProxyForAzure(Properties proxyProperties,
com.microsoft.azure.storage.OperationContext opContext)
A static function to set Azure proxy params for sessionless connections using the proxy params
from the StageInfo
|
static void |
setSessionlessProxyForS3(Properties proxyProperties,
com.amazonaws.ClientConfiguration clientConfig)
A static function to set S3 proxy params for sessionless connections using the proxy params
from the StageInfo
|
static void |
setSocksProxyDisabled(boolean socksProxyDisabled)
Enables/disables use of the SOCKS proxy when creating sockets
|
static void |
updateRoutePlanner(HttpClientSettingsKey key) |
public static final String JDBC_TTL
public static final String JDBC_MAX_CONNECTIONS_PROPERTY
public static final String JDBC_MAX_CONNECTIONS_PER_ROUTE_PROPERTY
public static Map<HttpClientSettingsKey,org.apache.http.impl.client.CloseableHttpClient> httpClient
public static long getDownloadedConditionTimeoutInSeconds()
public static void closeExpiredAndIdleConnections()
public static void setProxyForS3(HttpClientSettingsKey key, com.amazonaws.ClientConfiguration clientConfig)
key - key to HttpClient map containing OCSP and proxy infoclientConfig - the configuration needed by S3 to set the proxypublic static void setSessionlessProxyForS3(Properties proxyProperties, com.amazonaws.ClientConfiguration clientConfig) throws SnowflakeSQLException
proxyProperties - proxy propertiesclientConfig - the configuration needed by S3 to set the proxySnowflakeSQLExceptionpublic static void setSessionlessProxyForAzure(Properties proxyProperties, com.microsoft.azure.storage.OperationContext opContext) throws SnowflakeSQLException
proxyProperties - proxy propertiesopContext - the configuration needed by Azure to set the proxySnowflakeSQLExceptionpublic static void setProxyForAzure(HttpClientSettingsKey key, com.microsoft.azure.storage.OperationContext opContext)
key - key to HttpClient map containing OCSP and proxy infoopContext - the configuration needed by Azure to set the proxypublic static void updateRoutePlanner(HttpClientSettingsKey key)
public static org.apache.http.impl.client.CloseableHttpClient getHttpClient(HttpClientSettingsKey ocspAndProxyKey)
ocspAndProxyKey - OCSP mode and proxy settings for httpclientpublic static org.apache.http.impl.client.CloseableHttpClient getHttpClientWithoutDecompression(HttpClientSettingsKey ocspAndProxyKey)
ocspAndProxyKey - OCSP mode and proxy settings for httpclientpublic static org.apache.http.impl.client.CloseableHttpClient initHttpClientWithoutDecompression(HttpClientSettingsKey key, File ocspCacheFile)
key - contains information needed to build specific HttpClientocspCacheFile - OCSP response cache file name. if null, the default file will be used.public static org.apache.http.impl.client.CloseableHttpClient initHttpClient(HttpClientSettingsKey key, File ocspCacheFile)
key - contains information needed to build specific HttpClientocspCacheFile - OCSP response cache file name. if null, the default file will be used.public static org.apache.http.client.config.RequestConfig getDefaultRequestConfigWithSocketTimeout(int soTimeoutMs,
boolean withoutCookies)
soTimeoutMs - - custom socket timeout in milli-secondswithoutCookies - - whether this request should ignore cookies or notpublic static org.apache.http.client.config.RequestConfig getRequestConfigWithoutCookies()
public static void setRequestConfig(org.apache.http.client.config.RequestConfig requestConfig)
public static void setSocksProxyDisabled(boolean socksProxyDisabled)
socksProxyDisabled - new valuepublic static boolean isSocksProxyDisabled()
public static String executeGeneralRequest(org.apache.http.client.methods.HttpRequestBase httpRequest, int retryTimeout, HttpClientSettingsKey ocspAndProxyKey) throws SnowflakeSQLException, IOException
httpRequest - HttpRequestBaseretryTimeout - retry timeoutocspAndProxyKey - OCSP mode and proxy settings for httpclientSnowflakeSQLException - if Snowflake error occursIOException - raises if a general IO error occurspublic static String executeRequest(org.apache.http.client.methods.HttpRequestBase httpRequest, int retryTimeout, int injectSocketTimeout, AtomicBoolean canceling, boolean includeRetryParameters, boolean retryOnHTTP403, HttpClientSettingsKey ocspAndProxyKey) throws SnowflakeSQLException, IOException
httpRequest - HttpRequestBaseretryTimeout - retry timeoutinjectSocketTimeout - injecting socket timeoutcanceling - canceling?includeRetryParameters - whether to include retry parameters in retried requestsretryOnHTTP403 - whether to retry on HTTP 403 or notocspAndProxyKey - OCSP mode and proxy settings for httpclientSnowflakeSQLException - if Snowflake error occursIOException - raises if a general IO error occursCopyright © 2021. All rights reserved.