public static HttpResponse doDeleteExternalAPI(String resource, Header[] headers) throws Exception { return doDelete(resource, headers, externalBase); }
public static HttpResponse doGetExternalAPI(String resource, Header[] headers) throws Exception { return doGet(resource, headers, externalBase); }
public static HttpResponse doGetWithoutVersionExternalAPI(String resource) throws Exception { return doGetWithoutVersion(resource, externalPort); }
private static SSLContext getContext(File keyStore, String keyStorePassword, File trustKeyStore, String trustKeyStorePassword) throws NoSuchAlgorithmException { SSLContext sslContext = SSLContext.getInstance("TLS"); try { KeyManager[] keyManagers = null; if (keyStore != null && !Strings.isNullOrEmpty(keyStorePassword)) { KeyStore ks = getKeyStore(keyStore, keyStorePassword); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, keyStorePassword.toCharArray()); keyManagers = kmf.getKeyManagers(); } TrustManager[] trustManagers = getTrustAllManager(); if (trustKeyStore != null && !Strings.isNullOrEmpty(trustKeyStorePassword)) { KeyStore tks = getKeyStore(trustKeyStore, trustKeyStorePassword); TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); tmf.init(tks); trustManagers = tmf.getTrustManagers(); } sslContext.init(keyManagers, trustManagers, null); } catch (Exception e) { throw new IllegalArgumentException("Failed to initialize the client-side SSLContext", e); } return sslContext; }
public static HttpResponse doPutInternalAPI(String resource, String body) throws Exception { return doPut(resource, body, null, internalBase); }
public static HttpResponse doPostExternalAPI(String resource, String body, Header[] headers) throws Exception { return doPost(resource, body, headers, externalBase); }
public static Registry<ConnectionSocketFactory> getSimpleRegistry() throws NoSuchAlgorithmException, KeyManagementException { return getRegistry(null, null, null, null); }
public static String getBaseUrlInternalAPI() { return getBaseUrl(internalPort); }
public static Registry<ConnectionSocketFactory> getRegistry(File keyStore, String keyStorePassword, File trustKeyStore, String trustKeyStorePassword) throws KeyManagementException, NoSuchAlgorithmException { SSLContext sslContext = getContext(keyStore, keyStorePassword, trustKeyStore, trustKeyStorePassword); SSLConnectionSocketFactory sf = new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); return RegistryBuilder .<ConnectionSocketFactory>create().register("https", sf) .register("http", PlainConnectionSocketFactory.getSocketFactory()) .build(); }
public static HttpResponse doPutExternalAPI(String resource, String body, Header[] headers) throws Exception { return doPut(resource, body, headers, externalBase); }
public static HttpResponse doPostInternalAPI(String resource, String body) throws Exception { return doPost(resource, body, null, internalBase); }
public static HttpResponse doPutInternalAPI(String resource, String body, Header[] headers) throws Exception { return doPut(resource, body, headers, internalBase); }
public static HttpResponse doGetInternalAPI(String resource) throws Exception { return doGet(resource, null, internalBase); }