Interface AsyncHttpClient

  • All Known Implementing Classes:
    HttpAsyncClientImpl

    public interface AsyncHttpClient
    Simple abstraction over async http operations needed by the salt client.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default <T> java.util.concurrent.CompletionStage<T> get​(java.net.URI uri, JsonParser<T> parser)
      Send a GET request and parse the result into object of given type.
      <T> java.util.concurrent.CompletionStage<T> get​(java.net.URI uri, java.util.Map<java.lang.String,​java.lang.String> headers, JsonParser<T> parser)
      Send a GET request and parse the result into object of given type.
      default <T> java.util.concurrent.CompletionStage<T> post​(java.net.URI uri, java.lang.String data, JsonParser<T> parser)
      Send a POST request and parse the result into object of given type.
      <T> java.util.concurrent.CompletionStage<T> post​(java.net.URI uri, java.util.Map<java.lang.String,​java.lang.String> headers, java.lang.String data, JsonParser<T> parser)
      Send a POST request and parse the result into object of given type.
    • Method Detail

      • get

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

        default <T> java.util.concurrent.CompletionStage<T> get​(java.net.URI uri,
                                                                JsonParser<T> parser)
        Send a GET request and parse the result into object of given type.
        Type Parameters:
        T - return type the response json will be parsed into
        Parameters:
        uri - uri to make the http request to
        parser - parser to use for the response json
        Returns:
        CompletionStage holding object of the given return type T
      • post

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

        default <T> java.util.concurrent.CompletionStage<T> post​(java.net.URI uri,
                                                                 java.lang.String data,
                                                                 JsonParser<T> parser)
        Send a POST request and parse the result into object of given type.
        Type Parameters:
        T - return type the response json will be parsed into
        Parameters:
        data - the data to send (in JSON format)
        uri - uri to make the http request to
        parser - parser to use for the response json
        Returns:
        CompletionStage holding object of the given return type T