public class HttpUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
AWS_ELB_ENDPOINT_REGEX |
static Pattern |
AWS_ENDPOINT_REGEX |
static Pattern |
AWS_S3_ENDPOINT_REGEX |
static String |
AWS_S3_PREFIX |
static Pattern |
AWS_S3_PREFIX_REGEX |
static byte[] |
EMPTY_BODY |
static Pattern |
HOSTNAME_REGEX |
static Pattern |
REGION_REGEX |
Constructor and Description |
---|
HttpUtils() |
Modifier and Type | Method and Description |
---|---|
static okhttp3.OkHttpClient |
disableCertCheck(okhttp3.OkHttpClient client) |
static okhttp3.OkHttpClient |
enableExternalCertificates(okhttp3.OkHttpClient httpClient,
String filename)
copied logic from
https://github.com/square/okhttp/blob/master/samples/guide/src/main/java/okhttp3/recipes/CustomTrust.java
|
static okhttp3.OkHttpClient |
enableJKSCertificates(okhttp3.OkHttpClient httpClient,
String trustStorePath,
String trustStorePassword,
String keyStorePath,
String keyStorePassword) |
static okhttp3.OkHttpClient |
enablePKCS12Certificates(okhttp3.OkHttpClient httpClient,
String trustStorePath,
String trustStorePassword,
String keyStorePath,
String keyStorePassword) |
static okhttp3.HttpUrl |
getBaseUrl(String endpoint) |
static String |
getHostHeader(okhttp3.HttpUrl url) |
static okhttp3.OkHttpClient |
newDefaultHttpClient(long connectTimeout,
long writeTimeout,
long readTimeout) |
static okhttp3.OkHttpClient |
setTimeout(okhttp3.OkHttpClient client,
long connectTimeout,
long writeTimeout,
long readTimeout) |
static void |
validateHostnameOrIPAddress(String endpoint) |
static void |
validateNotEmptyString(String arg,
String argName) |
static void |
validateNotNull(Object arg,
String argName) |
static void |
validateNullOrNotEmptyString(String arg,
String argName) |
static void |
validateUrl(okhttp3.HttpUrl url) |
public static final String AWS_S3_PREFIX
public static final Pattern HOSTNAME_REGEX
public static final Pattern AWS_ENDPOINT_REGEX
public static final Pattern AWS_S3_ENDPOINT_REGEX
public static final Pattern AWS_ELB_ENDPOINT_REGEX
public static final Pattern AWS_S3_PREFIX_REGEX
public static final Pattern REGION_REGEX
public static final byte[] EMPTY_BODY
public static void validateNullOrNotEmptyString(String arg, String argName)
public static void validateHostnameOrIPAddress(String endpoint)
public static void validateUrl(okhttp3.HttpUrl url)
public static okhttp3.HttpUrl getBaseUrl(String endpoint)
public static String getHostHeader(okhttp3.HttpUrl url)
public static okhttp3.OkHttpClient enableJKSCertificates(okhttp3.OkHttpClient httpClient, String trustStorePath, String trustStorePassword, String keyStorePath, String keyStorePassword) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public static okhttp3.OkHttpClient enablePKCS12Certificates(okhttp3.OkHttpClient httpClient, String trustStorePath, String trustStorePassword, String keyStorePath, String keyStorePassword) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public static okhttp3.OkHttpClient enableExternalCertificates(okhttp3.OkHttpClient httpClient, String filename) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public static okhttp3.OkHttpClient newDefaultHttpClient(long connectTimeout, long writeTimeout, long readTimeout)
public static okhttp3.OkHttpClient disableCertCheck(okhttp3.OkHttpClient client) throws KeyManagementException, NoSuchAlgorithmException
public static okhttp3.OkHttpClient setTimeout(okhttp3.OkHttpClient client, long connectTimeout, long writeTimeout, long readTimeout)