Package org.silverpeas.core.util
Class HttpUtil
- java.lang.Object
-
- org.silverpeas.core.util.HttpUtil
-
public class HttpUtil extends Object
Centralizing the initializing of anHttpRequest
orHttpRequest.Builder
against the different Silverpeas's HTTP requirements such as proxy configurations for example.- Author:
- silveryocha
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpClient
httpClient()
Centralizing the getting of HTTP client configured with proxy host and proxy port if any.static HttpClient
httpClient(SSLContext sslContext)
Centralizing the getting of HTTP client configured with proxy host and proxy port if any and with the acceptance of optional given SSL context.static HttpClient
httpClientTrustingAnySslContext()
Centralizing the getting of HTTP client configured with proxy host and proxy port if any and with the acceptance of any SSL certificate whatever its validity.static HttpRequest.Builder
toUri(URI uri)
Centralizing the getting of HTTP request builder initialized with given URI.static HttpRequest.Builder
toUrl(String url)
Centralizing the getting of HTTP request builder initialized with given URL.
-
-
-
Method Detail
-
httpClient
public static HttpClient httpClient()
Centralizing the getting of HTTP client configured with proxy host and proxy port if any.- Returns:
- a
HttpClient
instance.
-
httpClientTrustingAnySslContext
public static HttpClient httpClientTrustingAnySslContext() throws GeneralSecurityException
Centralizing the getting of HTTP client configured with proxy host and proxy port if any and with the acceptance of any SSL certificate whatever its validity.- Returns:
- a
HttpClient
instance. - Throws:
GeneralSecurityException
-
httpClient
public static HttpClient httpClient(SSLContext sslContext)
Centralizing the getting of HTTP client configured with proxy host and proxy port if any and with the acceptance of optional given SSL context.- Parameters:
sslContext
- an optional SSL context.- Returns:
- a
HttpClient
instance.
-
toUrl
public static HttpRequest.Builder toUrl(String url)
Centralizing the getting of HTTP request builder initialized with given URL.- Parameters:
url
- the URL to request.- Returns:
- a
HttpRequest.Builder
instance.
-
toUri
public static HttpRequest.Builder toUri(URI uri)
Centralizing the getting of HTTP request builder initialized with given URI.- Parameters:
uri
- the URI to request.- Returns:
- a
HttpRequest.Builder
instance.
-
-