Package co.arago.hiro.client.connection
Class AbstractClientAPIHandler
- java.lang.Object
-
- co.arago.util.validation.RequiredFieldChecks
-
- co.arago.hiro.client.connection.AbstractAPIHandler
-
- co.arago.hiro.client.connection.AbstractClientAPIHandler
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
AbstractVersionAPIHandler
public abstract class AbstractClientAPIHandler extends AbstractAPIHandler implements java.lang.AutoCloseable
Class for API httpRequests that contains a HttpClient and a HttpLogger.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractClientAPIHandler.Conf<T extends AbstractClientAPIHandler.Conf<T>>static classAbstractClientAPIHandler.ProxySpecA simple data class for a proxy-
Nested classes/interfaces inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
AbstractAPIHandler.GetterConf
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.LongconnectTimeoutprotected booleanexternalHttpClientprotected booleanfollowRedirectsprotected java.net.http.HttpClienthttpClientprotected HttpLoggerhttpLoggerprotected intmaxConnectionPoolprotected AbstractClientAPIHandler.ProxySpecproxyprotected javax.net.ssl.SSLContextsslContextprotected javax.net.ssl.SSLParameterssslParameters-
Fields inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
apiUrl, httpRequestTimeout, maxRetries, title, userAgent, version, webSocketUri
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractClientAPIHandler(AbstractClientAPIHandler.Conf<?> builder)Protected Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Shut thehttpClientdown by shutting down its ExecutorService.HttpLoggergetHttpLogger()Abstract class that needs to be overwritten by a supplier of a HttpLogger.java.net.http.HttpClientgetOrBuildClient()ReturnhttpClient.-
Methods inherited from class co.arago.hiro.client.connection.AbstractAPIHandler
addQueryAndFragment, addToHeaders, buildApiURI, buildEndpointURI, buildURI, buildWebSocketURI, checkResponse, delete, executeAsyncWithStreamBody, executeAsyncWithStringBody, executeBinary, executeWithStreamBody, executeWithStringBody, get, getApiUrl, getBinary, getHttpRequestTimeout, getMaxRetries, getRequestBuilder, getUserAgent, getWebSocketUri, patch, patchBinary, post, postBinary, put, putBinary, send, sendAsync
-
-
-
-
Field Detail
-
proxy
protected final AbstractClientAPIHandler.ProxySpec proxy
-
followRedirects
protected final boolean followRedirects
-
connectTimeout
protected final java.lang.Long connectTimeout
-
sslParameters
protected final javax.net.ssl.SSLParameters sslParameters
-
httpClient
protected java.net.http.HttpClient httpClient
-
sslContext
protected javax.net.ssl.SSLContext sslContext
-
maxConnectionPool
protected final int maxConnectionPool
-
httpLogger
protected final HttpLogger httpLogger
-
externalHttpClient
protected boolean externalHttpClient
-
-
Constructor Detail
-
AbstractClientAPIHandler
protected AbstractClientAPIHandler(AbstractClientAPIHandler.Conf<?> builder)
Protected Constructor. Attributes shall be filled via builders.- Parameters:
builder- The builder to use.
-
-
Method Detail
-
getOrBuildClient
public java.net.http.HttpClient getOrBuildClient()
ReturnhttpClient. Build a new client if necessary.- Specified by:
getOrBuildClientin classAbstractAPIHandler- Returns:
- The cached HttpClient
-
close
public void close()
Shut thehttpClientdown by shutting down its ExecutorService. If thehttpClienthas been provided externally, this call will be ignored.- Specified by:
closein interfacejava.lang.AutoCloseable
-
getHttpLogger
public HttpLogger getHttpLogger()
Description copied from class:AbstractAPIHandlerAbstract class that needs to be overwritten by a supplier of a HttpLogger.- Specified by:
getHttpLoggerin classAbstractAPIHandler- Returns:
- The HttpLogger to use with this class.
-
-