public class FailoverHttpClient
extends java.lang.Object
Response
.
The failover (if enabled) in the following way:
my-registry:5000/my-repo
):
SSLException
, re-attempts secure HTTPS on the specified
port but disabling certificate validation.
SSLException
, attempts plain-HTTP on the specified
port.
my-registry/my-repo
):
SSLException
, re-attempts secure HTTPS on port 443 but
disabling certificate validation.
SSLException
, attempts plain-HTTP on port 80
(default HTTP port).
ConnectException
, attempts plain-HTTP on
port 80.
Constructor and Description |
---|
FailoverHttpClient(boolean enableHttpAndInsecureFailover,
boolean sendAuthorizationOverHttp,
java.util.function.Consumer<LogEvent> logger) |
Modifier and Type | Method and Description |
---|---|
Response |
call(java.lang.String httpMethod,
java.net.URL url,
Request request)
Sends the request.
|
Response |
get(java.net.URL url,
Request request)
Sends the request with method GET.
|
Response |
post(java.net.URL url,
Request request)
Sends the request with method POST.
|
Response |
put(java.net.URL url,
Request request)
Sends the request with method PUT.
|
void |
shutDown()
Closes all connections and allocated resources, whether they are currently used or not.
|
public FailoverHttpClient(boolean enableHttpAndInsecureFailover, boolean sendAuthorizationOverHttp, java.util.function.Consumer<LogEvent> logger)
public void shutDown() throws java.io.IOException
If an I/O error occurs, shutdown attempts stop immediately, resulting in partial resource release up to that point. The method can be called again later to re-attempt releasing all resources.
java.io.IOException
- when I/O error shutting down resourcespublic Response get(java.net.URL url, Request request) throws java.io.IOException
url
- endpoint URLrequest
- the request to sendjava.io.IOException
- if sending the request failspublic Response post(java.net.URL url, Request request) throws java.io.IOException
url
- endpoint URLrequest
- the request to sendjava.io.IOException
- if sending the request failspublic Response put(java.net.URL url, Request request) throws java.io.IOException
url
- endpoint URLrequest
- the request to sendjava.io.IOException
- if sending the request failspublic Response call(java.lang.String httpMethod, java.net.URL url, Request request) throws java.io.IOException
httpMethod
- the HTTP request methodurl
- endpoint URLrequest
- the request to sendjava.io.IOException
- if building the HTTP request fails.