T
- type of result retrieved using this HTTP connectionpublic class HttpClientConnection<T> extends Object implements Connection<T>
Constructor and Description |
---|
HttpClientConnection(String endpointIn,
JsonParser<T> parserIn,
ClientConfig configIn)
Init a connection to a given Salt API endpoint.
|
Modifier and Type | Method and Description |
---|---|
protected void |
customizeHttpClient(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder)
Allow subclasses to customize the
HttpClientBuilder as needed. |
T |
getResult()
Send a GET request and parse the result into object of given
Type . |
T |
getResult(String data)
Send a POST request and parse the result into object of given
Type . |
public HttpClientConnection(String endpointIn, JsonParser<T> parserIn, ClientConfig configIn)
endpointIn
- the endpointparserIn
- the parserconfigIn
- the configpublic T getResult(String data) throws SaltException
Type
.getResult
in interface Connection<T>
data
- the data to send (in JSON format)SaltException
- if the request was not successfulpublic T getResult() throws SaltException
Type
.getResult
in interface Connection<T>
SaltException
- if the request was not successfulprotected void customizeHttpClient(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder)
HttpClientBuilder
as needed.httpClientBuilder
- the HttpClientBuilder
to be customizedCopyright © 2016. All rights reserved.