Class HttpService
- java.lang.Object
-
- io.jans.configapi.core.test.service.HttpService
-
- All Implemented Interfaces:
Serializable
public class HttpService extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Constructor Description HttpService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.conn.routing.HttpRoutePlanner
buildDefaultRoutePlanner(String proxy)
org.apache.http.conn.routing.HttpRoutePlanner
buildDefaultRoutePlanner(String hostname, int port, String scheme)
String
constructServerUrl(jakarta.servlet.http.HttpServletRequest request)
void
consume(org.apache.http.HttpResponse httpResponse)
String
convertEntityToString(byte[] responseBytes)
String
convertEntityToString(byte[] responseBytes, String charsetName)
String
convertEntityToString(byte[] responseBytes, Charset charset)
String
encodeBase64(String value)
String
encodeUrl(String value)
io.jans.model.net.HttpServiceResponse
executeGet(String requestUri, Map<String,String> headers)
io.jans.model.net.HttpServiceResponse
executeGet(String requestUri, Map<String,String> headers, Map<String,String> data)
io.jans.model.net.HttpServiceResponse
executeGet(org.apache.http.client.HttpClient httpClient, String requestUri)
io.jans.model.net.HttpServiceResponse
executeGet(org.apache.http.client.HttpClient httpClient, String requestUri, Map<String,String> headers, Map<String,String> parameters)
io.jans.model.net.HttpServiceResponse
executePost(String uri, String authCode, String postData, org.apache.http.entity.ContentType contentType, String authType)
io.jans.model.net.HttpServiceResponse
executePost(org.apache.http.client.HttpClient httpClient, String uri, String authCode, String postData, org.apache.http.entity.ContentType contentType)
io.jans.model.net.HttpServiceResponse
executePost(org.apache.http.client.HttpClient httpClient, String uri, String authCode, Map<String,String> headers, String postData)
io.jans.model.net.HttpServiceResponse
executePost(org.apache.http.client.HttpClient httpClient, String uri, String authCode, Map<String,String> headers, String postData, org.apache.http.entity.ContentType contentType, String authType)
org.apache.http.impl.client.CloseableHttpClient
getHttpsClient()
org.apache.http.impl.client.CloseableHttpClient
getHttpsClient(String trustStorePath, String trustStorePassword)
org.apache.http.impl.client.CloseableHttpClient
getHttpsClient(String trustStorePath, String trustStorePassword, String keyStorePath, String keyStorePassword)
org.apache.http.impl.client.CloseableHttpClient
getHttpsClient(org.apache.http.client.config.RequestConfig requestConfig)
org.apache.http.impl.client.CloseableHttpClient
getHttpsClient(org.apache.http.client.config.RequestConfig requestConfig, org.apache.http.conn.routing.HttpRoutePlanner routerPlanner)
org.apache.http.impl.client.CloseableHttpClient
getHttpsClient(org.apache.http.conn.routing.HttpRoutePlanner routerPlanner)
org.apache.http.impl.client.CloseableHttpClient
getHttpsClientTrustAll()
byte[]
getResponseContent(org.apache.http.HttpResponse httpResponse)
void
init()
boolean
isContentTypeXml(org.apache.http.HttpResponse httpResponse)
boolean
isResponseStastusCodeOk(org.apache.http.HttpResponse httpResponse)
boolean
isResponseStatusCodeOk(org.apache.http.HttpResponse httpResponse)
-
-
-
Method Detail
-
init
@PostConstruct public void init()
-
getHttpsClientTrustAll
public org.apache.http.impl.client.CloseableHttpClient getHttpsClientTrustAll() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException
-
getHttpsClient
public org.apache.http.impl.client.CloseableHttpClient getHttpsClient()
-
getHttpsClient
public org.apache.http.impl.client.CloseableHttpClient getHttpsClient(org.apache.http.client.config.RequestConfig requestConfig)
-
getHttpsClient
public org.apache.http.impl.client.CloseableHttpClient getHttpsClient(org.apache.http.conn.routing.HttpRoutePlanner routerPlanner)
-
getHttpsClient
public org.apache.http.impl.client.CloseableHttpClient getHttpsClient(org.apache.http.client.config.RequestConfig requestConfig, org.apache.http.conn.routing.HttpRoutePlanner routerPlanner)
-
getHttpsClient
public org.apache.http.impl.client.CloseableHttpClient getHttpsClient(String trustStorePath, String trustStorePassword) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException
-
getHttpsClient
public org.apache.http.impl.client.CloseableHttpClient getHttpsClient(String trustStorePath, String trustStorePassword, String keyStorePath, String keyStorePassword) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, UnrecoverableKeyException
-
executePost
public io.jans.model.net.HttpServiceResponse executePost(org.apache.http.client.HttpClient httpClient, String uri, String authCode, Map<String,String> headers, String postData, org.apache.http.entity.ContentType contentType, String authType)
-
executePost
public io.jans.model.net.HttpServiceResponse executePost(org.apache.http.client.HttpClient httpClient, String uri, String authCode, Map<String,String> headers, String postData)
-
executePost
public io.jans.model.net.HttpServiceResponse executePost(org.apache.http.client.HttpClient httpClient, String uri, String authCode, String postData, org.apache.http.entity.ContentType contentType)
-
executePost
public io.jans.model.net.HttpServiceResponse executePost(String uri, String authCode, String postData, org.apache.http.entity.ContentType contentType, String authType)
-
executeGet
public io.jans.model.net.HttpServiceResponse executeGet(org.apache.http.client.HttpClient httpClient, String requestUri, Map<String,String> headers, Map<String,String> parameters)
-
executeGet
public io.jans.model.net.HttpServiceResponse executeGet(String requestUri, Map<String,String> headers, Map<String,String> data)
-
executeGet
public io.jans.model.net.HttpServiceResponse executeGet(String requestUri, Map<String,String> headers)
-
executeGet
public io.jans.model.net.HttpServiceResponse executeGet(org.apache.http.client.HttpClient httpClient, String requestUri)
-
getResponseContent
public byte[] getResponseContent(org.apache.http.HttpResponse httpResponse) throws IOException
- Throws:
IOException
-
consume
public void consume(org.apache.http.HttpResponse httpResponse) throws IOException
- Throws:
IOException
-
convertEntityToString
public String convertEntityToString(byte[] responseBytes)
-
convertEntityToString
public String convertEntityToString(byte[] responseBytes, String charsetName) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
isResponseStastusCodeOk
public boolean isResponseStastusCodeOk(org.apache.http.HttpResponse httpResponse)
-
isResponseStatusCodeOk
public boolean isResponseStatusCodeOk(org.apache.http.HttpResponse httpResponse)
-
isContentTypeXml
public boolean isContentTypeXml(org.apache.http.HttpResponse httpResponse)
-
constructServerUrl
public String constructServerUrl(jakarta.servlet.http.HttpServletRequest request)
-
buildDefaultRoutePlanner
public org.apache.http.conn.routing.HttpRoutePlanner buildDefaultRoutePlanner(String hostname, int port, String scheme)
-
buildDefaultRoutePlanner
public org.apache.http.conn.routing.HttpRoutePlanner buildDefaultRoutePlanner(String proxy)
-
-