Package com.boomi.common.rest
Class RestClient
- java.lang.Object
-
- com.boomi.common.rest.RestClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
OpenAPIRestClient
public class RestClient extends Object implements Closeable
RestClient handles execution and creation of HttpRequest
-
-
Constructor Summary
Constructors Constructor Description RestClient(RestOperationConnection connection)
Creates a RestClient fromRestConnection
details.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the underlying RestClient.RequestBuilder
createRequestBuilder(URI uri)
Creates aRequestBuilder
with the predefined REST Method for the URI.Iterable<HttpResult>
execute(RequestBuilder request)
Builds and executes incomingRequestBuilder
request.protected Iterable<HttpResult>
getHttpResults(CloseableHttpResponse response)
Creates a singleSimpleHttpResult
with givenPayloadMetadataFactory
-
-
-
Constructor Detail
-
RestClient
public RestClient(RestOperationConnection connection)
Creates a RestClient fromRestConnection
details.- Parameters:
connection
-
-
-
Method Detail
-
close
public void close() throws IOException
Closes the underlying RestClient. A new instance will need to be created after close.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
createRequestBuilder
public RequestBuilder createRequestBuilder(URI uri)
Creates aRequestBuilder
with the predefined REST Method for the URI.- Parameters:
uri
-- Returns:
- the Request Builder.
-
execute
public Iterable<HttpResult> execute(RequestBuilder request) throws IOException
Builds and executes incomingRequestBuilder
request.- Parameters:
request
-- Returns:
- Iterable List of HTTP Results
- Throws:
IOException
-
getHttpResults
protected Iterable<HttpResult> getHttpResults(CloseableHttpResponse response)
Creates a singleSimpleHttpResult
with givenPayloadMetadataFactory
- Parameters:
response
- HTTP response from the endpoint.- Returns:
- Single
SimpleHttpResult
with givenPayloadMetadataFactory
-
-