public class RestClient extends Object implements Closeable
Constructor and Description |
---|
RestClient(RestOperationConnection connection)
Creates a RestClient from
RestConnection details. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying RestClient.
|
org.apache.http.client.methods.RequestBuilder |
createRequestBuilder(URI uri)
Creates a
RequestBuilder with the predefined REST Method for the URI. |
Iterable<HttpResult> |
execute(org.apache.http.client.methods.RequestBuilder request)
Builds and executes incoming
RequestBuilder request. |
protected Iterable<HttpResult> |
getHttpResults(org.apache.http.client.methods.CloseableHttpResponse response)
Creates a single
SimpleHttpResult with given PayloadMetadataFactory |
public RestClient(RestOperationConnection connection)
RestConnection
details.connection
- public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public org.apache.http.client.methods.RequestBuilder createRequestBuilder(URI uri)
RequestBuilder
with the predefined REST Method for the URI.uri
- public Iterable<HttpResult> execute(org.apache.http.client.methods.RequestBuilder request) throws IOException
RequestBuilder
request.request
- IOException
protected Iterable<HttpResult> getHttpResults(org.apache.http.client.methods.CloseableHttpResponse response)
SimpleHttpResult
with given PayloadMetadataFactory
response
- HTTP response from the endpoint.SimpleHttpResult
with given PayloadMetadataFactory