Class NewHttpClientImpl

  • All Implemented Interfaces:
    HttpClient

    public class NewHttpClientImpl
    extends Object
    implements HttpClient
    This class implements the java native client library.
    Author:
    smruti.sahoo@siemens.com
    • Constructor Detail

      • NewHttpClientImpl

        public NewHttpClientImpl​(HttpClient client,
                                 com.fasterxml.jackson.databind.ObjectMapper mapper)
        Creates a new instance of NewHttpClientImpl with the dependencies passed in.
        Parameters:
        client - the underlying HTTP client
        mapper - the JSON object mapper
    • Method Detail

      • execute

        public <T> CompletableFuture<T> execute​(Consumer<? super RequestBuilder> producer,
                                                ResponseProcessor<? extends T> processor)
        Description copied from interface: HttpClient
        Executes an HTTP request asynchronously and returns a future object with the result. The method first invokes the Consumer to generate the request to be executed. This request is then sent to the server. If sending fails, e.g. because no connection could be established, the resulting future is failed with the corresponding exception. Otherwise, the ResponseProcessor is invoked with a representation of the response; the outcome of this object is then used to complete the result future.
        Specified by:
        execute in interface HttpClient
        Type Parameters:
        T - the type of the result produced by the ResponseProcessor
        Parameters:
        producer - the object to produce the request
        processor - the object to process the response
        Returns:
        a future with the result of the execution