Package swiss.trustbroker.common.util
Class HttpUtil
java.lang.Object
swiss.trustbroker.common.util.HttpUtil
HTTP utility functions.
XTB uses the Java HTTP client, but as OpenSAML uses the Apache HTTP client some API calls need that.
XTB uses the Java HTTP client, but as OpenSAML uses the Apache HTTP client some API calls need that.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hc.client5.http.impl.classic.CloseableHttpClientcreateApacheHttpClient(String scheme, KeystoreProperties truststoreParameters, KeystoreProperties keystoreParameters, String keystoreBasePath, String proxyUrl, Duration connectTimeout) static HttpClientcreateHttpClient(String scheme, KeystoreProperties truststoreParameters, Duration connectTimeout) static HttpClientcreateHttpClient(String scheme, KeystoreProperties truststoreParameters, KeystoreProperties keystoreParameters, String keystoreBasePath, URI proxyUri, HttpClient.Version protocolVersion, Duration connectTimeout) static intgetDefaultPort(URI uri) static Optional<InputStream> getHttpFormPostStream(HttpClient httpClient, URI uri, Map<String, String> params, Map<String, String> headers) getHttpFormPostString(HttpClient httpClient, URI uri, Map<String, String> params, Map<String, String> headers) static Optional<HttpResponse<String>> getHttpFormPostStringResonse(HttpClient httpClient, URI uri, Map<String, String> params, Map<String, String> headers) static Optional<InputStream> getHttpResponseStream(HttpClient httpClient, URI uri) getHttpResponseString(HttpClient httpClient, URI uri) getHttpString(HttpClient httpClient, URI uri, Map<String, String> headers) static Optional<HttpResponse<String>> getHttpStringResponse(HttpClient httpClient, URI uri, Map<String, String> headers) patchHttpResponseString(HttpClient httpClient, URI uri, String body, Map<String, String> headers) static Optional<HttpResponse<String>> postHttpResponse(HttpClient httpClient, URI uri, String body, Map<String, String> headers) postHttpResponseString(HttpClient httpClient, URI uri, String body, Map<String, String> headers)
-
Field Details
-
SCHEME_HTTPS
- See Also:
-
SCHEME_HTTP
- See Also:
-
-
Method Details
-
createHttpClient
public static HttpClient createHttpClient(String scheme, KeystoreProperties truststoreParameters, Duration connectTimeout) -
createHttpClient
public static HttpClient createHttpClient(String scheme, KeystoreProperties truststoreParameters, KeystoreProperties keystoreParameters, String keystoreBasePath, URI proxyUri, HttpClient.Version protocolVersion, Duration connectTimeout) -
getHttpFormPostStringResonse
-
getHttpFormPostString
-
getHttpFormPostStream
public static Optional<InputStream> getHttpFormPostStream(HttpClient httpClient, URI uri, Map<String, String> params, Map<String, String> headers) -
getHttpString
-
getHttpStringResponse
public static Optional<HttpResponse<String>> getHttpStringResponse(HttpClient httpClient, URI uri, Map<String, String> headers) -
getHttpResponseString
-
getHttpResponseStream
-
postHttpResponseString
-
postHttpResponse
public static Optional<HttpResponse<String>> postHttpResponse(HttpClient httpClient, URI uri, String body, Map<String, String> headers) -
patchHttpResponseString
-
createApacheHttpClient
public static org.apache.hc.client5.http.impl.classic.CloseableHttpClient createApacheHttpClient(String scheme, KeystoreProperties truststoreParameters, KeystoreProperties keystoreParameters, String keystoreBasePath, String proxyUrl, Duration connectTimeout) -
getDefaultPort
-