Package com.suse.salt.netapi.client.impl
Class HttpAsyncClientImpl
- java.lang.Object
-
- com.suse.salt.netapi.client.impl.HttpAsyncClientImpl
-
- All Implemented Interfaces:
AsyncHttpClient
public class HttpAsyncClientImpl extends Object implements AsyncHttpClient
AsyncHttpClient implemented with Apache's HttpAsyncClient.
-
-
Constructor Summary
Constructors Constructor Description HttpAsyncClientImpl(org.apache.http.nio.client.HttpAsyncClient httpClientIn)
Init a connection to a given Salt API endpoint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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.<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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.suse.salt.netapi.client.AsyncHttpClient
get, post
-
-
-
-
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 interfaceAsyncHttpClient
- Type Parameters:
T
- return type the response json will be parsed into- Parameters:
uri
- uri to make the http request toheaders
- headers to pass to the requestdata
- 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 interfaceAsyncHttpClient
- Type Parameters:
T
- return type the response json will be parsed into- Parameters:
uri
- uri to make the http request toheaders
- headers to pass to the requestparser
- parser to use for the response json- Returns:
- CompletionStage holding object of the given return type T
-
-