Class HTTPSClientUtils
- java.lang.Object
-
- org.wso2.am.integration.test.utils.http.HTTPSClientUtils
-
public class HTTPSClientUtils extends Object
This class is high level implementation for the HTTP client for Secure connection
-
-
Constructor Summary
Constructors Constructor Description HTTPSClientUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoGet(String url, Map<String,String> headers)do HTTP GET operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoMutulSSLGet(String path, String url, Map<String,String> headers)To do HTTPS GET operation for the given URL with mutual SSL.static org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoPost(String url, Map<String,String> headers, String payload)do HTTP POST operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoPost(String url, Map<String,String> headers, List<org.apache.http.NameValuePair> urlParameters)do HTTP POST operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoPost(URL url, String urlParams, Map<String,String> headers)do HTTP POST operation for the given URLstatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoPost(URL url, Map<String,String> headers, String json)do HTTP POST operation for the given URL with JSON entitystatic org.wso2.carbon.automation.test.utils.http.client.HttpResponsedoPut(String url, Map<String,String> headers, String payload)do HTTP PUT operation for the given URLstatic org.apache.http.impl.client.CloseableHttpClientgetHttpsClient()get the HTTP Clientstatic StringgetResponseBody(org.apache.http.HttpResponse response)read the response body as String
-
-
-
Method Detail
-
doGet
public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doGet(String url, Map<String,String> headers) throws IOException
do 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 IOException
do 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, UnrecoverableKeyException
To 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 IOException
do 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 IOException
do 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 IOException
do 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 IOException
do HTTP POST operation for the given URL- Parameters:
url- request URLheaders- headers to be sendurlParams- parameter string to be sent as payload- 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
public static String getResponseBody(org.apache.http.HttpResponse response) throws IOException
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
-
-