public class HttpUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpUtil.HttpInputStream |
Constructor and Description |
---|
HttpUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
closeExpiredAndIdleConnections() |
static void |
configureCustomProxyProperties(Map<SFSessionProperty,Object> connectionPropertiesMap)
configure custom proxy properties from connectionPropertiesMap
|
static String |
executeGeneralRequest(org.apache.http.client.methods.HttpRequestBase httpRequest,
int retryTimeout,
OCSPMode ocspMode)
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,
OCSPMode ocspMode)
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(OCSPMode ocspMode)
Gets HttpClient with insecureMode false
|
static org.apache.http.impl.client.CloseableHttpClient |
getHttpClientWithoutDecompression(OCSPMode ocspMode)
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(OCSPMode ocspMode,
File ocspCacheFile)
Accessor for the HTTP client singleton.
|
static org.apache.http.impl.client.CloseableHttpClient |
initHttpClientWithoutDecompression(OCSPMode ocspMode,
File ocspCacheFile)
Accessor for the HTTP client singleton.
|
static boolean |
isSocksProxyDisabled()
Returns whether the SOCKS proxy is disabled for this JVM
|
static void |
setProxyForAzure(com.microsoft.azure.storage.OperationContext opContext) |
static void |
setProxyForS3(com.amazonaws.ClientConfiguration clientConfig) |
static void |
setRequestConfig(org.apache.http.client.config.RequestConfig requestConfig) |
static void |
setSocksProxyDisabled(boolean socksProxyDisabled)
Enables/disables use of the SOCKS proxy when creating sockets
|
public static final String JDBC_TTL
public static long getDownloadedConditionTimeoutInSeconds()
public static void closeExpiredAndIdleConnections()
public static void setProxyForS3(com.amazonaws.ClientConfiguration clientConfig)
public static void setProxyForAzure(com.microsoft.azure.storage.OperationContext opContext)
public static org.apache.http.impl.client.CloseableHttpClient getHttpClient(OCSPMode ocspMode)
ocspMode
- OCSP modepublic static org.apache.http.impl.client.CloseableHttpClient getHttpClientWithoutDecompression(OCSPMode ocspMode)
ocspMode
- OCSP modepublic static org.apache.http.impl.client.CloseableHttpClient initHttpClientWithoutDecompression(OCSPMode ocspMode, File ocspCacheFile)
ocspMode
- OCSP modeocspCacheFile
- OCSP response cache file name. if null, the default file will be used.public static org.apache.http.impl.client.CloseableHttpClient initHttpClient(OCSPMode ocspMode, File ocspCacheFile)
ocspMode
- OCSP modeocspCacheFile
- 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, OCSPMode ocspMode) throws SnowflakeSQLException, IOException
httpRequest
- HttpRequestBaseretryTimeout
- retry timeoutocspMode
- OCSP modeSnowflakeSQLException
- 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, OCSPMode ocspMode) 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 notocspMode
- OCSP modeSnowflakeSQLException
- if Snowflake error occursIOException
- raises if a general IO error occurspublic static void configureCustomProxyProperties(Map<SFSessionProperty,Object> connectionPropertiesMap) throws SnowflakeSQLException
SnowflakeSQLException
Copyright © 2021. All rights reserved.