Class HttpAsyncClientImpl

    • Constructor Detail

      • HttpAsyncClientImpl

        public HttpAsyncClientImpl​(org.apache.http.nio.client.HttpAsyncClient httpClientIn)
        Init a connection to a given Salt API endpoint.
        Parameters:
        httpClientIn - the HTTP client
    • Method Detail

      • post

        public <T> CompletionStage<T> post​(URI uri,
                                           Map<String,​String> headers,
                                           String data,
                                           JsonParser<T> parser)
        Send a POST request and parse the result into object of given type.
        Specified by:
        post in interface AsyncHttpClient
        Type Parameters:
        T - return type the response json will be parsed into
        Parameters:
        uri - uri to make the http request to
        headers - headers to pass to the request
        data - the data to send (in JSON format)
        parser - parser to use for the response json
        Returns:
        CompletionStage holding object of the given return type T
      • get

        public <T> CompletionStage<T> get​(URI uri,
                                          Map<String,​String> headers,
                                          JsonParser<T> parser)
        Send a GET request and parse the result into object of given type.
        Specified by:
        get in interface AsyncHttpClient
        Type Parameters:
        T - return type the response json will be parsed into
        Parameters:
        uri - uri to make the http request to
        headers - headers to pass to the request
        parser - parser to use for the response json
        Returns:
        CompletionStage holding object of the given return type T