Package de.chojo.nexus
Class NexusRestImpl
java.lang.Object
de.chojo.nexus.NexusRestImpl
- All Implemented Interfaces:
NexusRest
Implementation of a rest client
-
Constructor Summary
ConstructorsConstructorDescriptionNexusRestImpl(HttpClient http, ScheduledExecutorService executorService, String host, Map<String, String> header) Create a new nexus rest client -
Method Summary
Modifier and TypeMethodDescription<T> T<T> CompletableFuture<T>deleteAsync(URI uri) <T> T<T> CompletableFuture<T>dispatchAsync(Callable<T> callable) <T> TSend a request and map the result body<T> TSend a request and map the result body<T> List<T>getAndMapList(URI uri, Class<T> result) Send a request and map the result body<T> CompletableFuture<T>getAsyncAndMap(URI uri, Class<T> result) Send an asynchronous request to the uri and map the result body<T> CompletableFuture<T>getAsyncAndMap(org.apache.hc.core5.net.URIBuilder uri, Class<T> result) Send an asynchronous request to the uri and map the result body<T> CompletableFuture<List<T>>getAsyncAndMapList(URI uri, Class<T> result) Send an asynchronous request to the uri and map the result bodyCompletableFuture<byte[]>getAsyncBytes(URI uri) getAsyncStream(URI uri) getAsyncToFile(URI uri, @Nullable Path path) byte[]http()Get the http clientcom.fasterxml.jackson.databind.ObjectMapperGet the object mapperorg.apache.hc.core5.net.URIBuilderuri()Get a pre configured uri builderv1()
-
Constructor Details
-
NexusRestImpl
public NexusRestImpl(HttpClient http, ScheduledExecutorService executorService, String host, Map<String, String> header) Create a new nexus rest client- Parameters:
http- http clientexecutorService- executor serviceheader-
-
-
Method Details
-
http
Get the http client- Returns:
- http client
-
uri
public org.apache.hc.core5.net.URIBuilder uri()Get a pre configured uri builder- Returns:
- new uri builder
-
objectMapper
public com.fasterxml.jackson.databind.ObjectMapper objectMapper()Get the object mapper- Returns:
- object mapper
-
getAsyncAndMap
public <T> CompletableFuture<T> getAsyncAndMap(org.apache.hc.core5.net.URIBuilder uri, Class<T> result) Send an asynchronous request to the uri and map the result body- Type Parameters:
T- result type- Parameters:
uri- uriresult- result class- Returns:
- future with result
-
getAndMap
Send a request and map the result body- Type Parameters:
T- result type- Parameters:
uri- uriresult- result class- Returns:
- result
-
getAsyncAndMap
Send an asynchronous request to the uri and map the result body- Type Parameters:
T- result type- Parameters:
uri- uriresult- result class- Returns:
- future with result
-
getAndMap
Send a request and map the result body- Type Parameters:
T- result type- Parameters:
uri- uriresult- result class- Returns:
- result
-
dispatch
-
dispatchAsync
-
getAsyncAndMapList
Send an asynchronous request to the uri and map the result body- Type Parameters:
T- result type- Parameters:
uri- uriresult- result class- Returns:
- future with result
-
getAndMapList
Send a request and map the result body- Type Parameters:
T- result type- Parameters:
uri- uriresult- result class- Returns:
- result
-
getBytes
-
getAsyncBytes
-
getStream
-
getAsyncStream
-
getToFile
-
getAsyncToFile
-
v1
-
deleteAsync
-
delete
-