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 fromRestConnectiondetails.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying RestClient.RequestBuildercreateRequestBuilder(URI uri)Creates aRequestBuilderwith the predefined REST Method for the URI.Iterable<HttpResult>execute(RequestBuilder request)Builds and executes incomingRequestBuilderrequest.protected Iterable<HttpResult>getHttpResults(CloseableHttpResponse response)Creates a singleSimpleHttpResultwith givenPayloadMetadataFactory
-
-
-
Constructor Detail
-
RestClient
public RestClient(RestOperationConnection connection)
Creates a RestClient fromRestConnectiondetails.- Parameters:
connection-
-
-
Method Detail
-
close
public void close() throws IOExceptionCloses the underlying RestClient. A new instance will need to be created after close.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
createRequestBuilder
public RequestBuilder createRequestBuilder(URI uri)
Creates aRequestBuilderwith 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 incomingRequestBuilderrequest.- Parameters:
request-- Returns:
- Iterable List of HTTP Results
- Throws:
IOException
-
getHttpResults
protected Iterable<HttpResult> getHttpResults(CloseableHttpResponse response)
Creates a singleSimpleHttpResultwith givenPayloadMetadataFactory- Parameters:
response- HTTP response from the endpoint.- Returns:
- Single
SimpleHttpResultwith givenPayloadMetadataFactory
-
-