Class NexusRestImpl

java.lang.Object
de.chojo.nexus.NexusRestImpl
All Implemented Interfaces:
NexusRest

public class NexusRestImpl extends Object implements NexusRest
Implementation of a rest client
  • Constructor Details

  • Method Details

    • http

      public HttpClient 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 - uri
      result - result class
      Returns:
      future with result
    • getAndMap

      public <T> T getAndMap(org.apache.hc.core5.net.URIBuilder uri, Class<T> result)
      Send a request and map the result body
      Type Parameters:
      T - result type
      Parameters:
      uri - uri
      result - result class
      Returns:
      result
    • getAsyncAndMap

      public <T> CompletableFuture<T> getAsyncAndMap(URI uri, Class<T> result)
      Send an asynchronous request to the uri and map the result body
      Type Parameters:
      T - result type
      Parameters:
      uri - uri
      result - result class
      Returns:
      future with result
    • getAndMap

      public <T> T getAndMap(URI uri, Class<T> result)
      Send a request and map the result body
      Type Parameters:
      T - result type
      Parameters:
      uri - uri
      result - result class
      Returns:
      result
    • dispatch

      public <T> T dispatch(Callable<T> callable)
    • dispatchAsync

      public <T> CompletableFuture<T> dispatchAsync(Callable<T> callable)
    • getAsyncAndMapList

      public <T> CompletableFuture<List<T>> getAsyncAndMapList(URI uri, Class<T> result)
      Send an asynchronous request to the uri and map the result body
      Type Parameters:
      T - result type
      Parameters:
      uri - uri
      result - result class
      Returns:
      future with result
    • getAndMapList

      public <T> List<T> getAndMapList(URI uri, Class<T> result)
      Send a request and map the result body
      Type Parameters:
      T - result type
      Parameters:
      uri - uri
      result - result class
      Returns:
      result
    • getBytes

      public byte[] getBytes(URI uri)
    • getAsyncBytes

      public CompletableFuture<byte[]> getAsyncBytes(URI uri)
    • getStream

      public InputStream getStream(URI uri)
    • getAsyncStream

      public CompletableFuture<InputStream> getAsyncStream(URI uri)
    • getToFile

      public Path getToFile(URI uri, @Nullable @Nullable Path path)
    • getAsyncToFile

      public CompletableFuture<Path> getAsyncToFile(URI uri, @Nullable @Nullable Path path)
    • v1

      public V1 v1()
      Specified by:
      v1 in interface NexusRest
    • deleteAsync

      public <T> CompletableFuture<T> deleteAsync(URI uri)
    • delete

      public <T> T delete(URI uri)