Class HTTPSClientUtils
java.lang.Object
org.wso2.am.integration.test.utils.http.HTTPSClientUtils
This class is high level implementation for the HTTP client for Secure connection
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedo HTTP GET operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponseTo do HTTPS GET operation for the given URL with mutual SSL.static org.wso2.carbon.automation.test.utils.http.client.HttpResponsedo HTTP POST operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedo HTTP POST operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedo HTTP POST operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedo HTTP POST operation for the given URL with JSON entitystatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedo HTTP PUT operation for the given URLstatic org.apache.http.impl.client.CloseableHttpClientget the HTTP Clientstatic StringgetResponseBody(org.apache.http.HttpResponse response) read the response body as String
-
Constructor Details
-
HTTPSClientUtils
public HTTPSClientUtils()
-
-
Method Details
-
doGet
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doGet(String url, Map<String, String> headers) throws IOExceptiondo HTTP GET operation for the given URL- Parameters:
url- request URLheaders- headers to be send- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException- if connection issue occurred
-
doPost
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(String url, Map<String, String> headers, List<org.apache.http.NameValuePair> urlParameters) throws IOExceptiondo HTTP POST operation for the given URL- Parameters:
url- request URLheaders- headers to be sendurlParameters- parameters to be sent as payload- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException- if connection issue occurred
-
doMutulSSLGet
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doMutulSSLGet(String path, String url, Map<String, String> headers) throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, UnrecoverableKeyExceptionTo do HTTPS GET operation for the given URL with mutual SSL.- Parameters:
url- request URLheaders- headers to be send- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException- if connection issue occurredNoSuchAlgorithmExceptionKeyStoreExceptionKeyManagementExceptionUnrecoverableKeyException
-
doPost
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(String url, Map<String, String> headers, String payload) throws IOExceptiondo HTTP POST operation for the given URL- Parameters:
url- request URLheaders- headers to be sent- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException- if connection issue occurred
-
doPut
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPut(String url, Map<String, String> headers, String payload) throws IOExceptiondo HTTP PUT operation for the given URL- Parameters:
url- request URLheaders- headers to be sent- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException- if connection issue occurred
-
doPost
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(URL url, Map<String, String> headers, String json) throws IOExceptiondo HTTP POST operation for the given URL with JSON entity- Parameters:
url-headers-json-- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException
-
doPost
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(URL url, String urlParams, Map<String, String> headers) throws IOExceptiondo HTTP POST operation for the given URL- Parameters:
url- request URLurlParams- parameter string to be sent as payloadheaders- headers to be send- Returns:
- org.wso2.carbon.automation.test.utils.http.client.HttpResponse
- Throws:
IOException- if connection issue occurred
-
getHttpsClient
public static org.apache.http.impl.client.CloseableHttpClient getHttpsClient()get the HTTP Client- Returns:
- CloseableHttpClient
-
getResponseBody
read the response body as String- Parameters:
response- http response with type org.apache.http.HttpResponse- Returns:
- String of the response body
- Throws:
IOException- throws if any error occurred
-