Package com.morpheusdata.core.util
Class HttpApiClient
java.lang.Object
com.morpheusdata.core.util.HttpApiClient
Utility methods for calling external APIs in a standardized way.
- Since:
- 0.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.slf4j.Logger
Sets a throttle rate (in milliseconds) between HTTP Calls. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRequiredHeader
(Map<CharSequence, CharSequence> headers, String name, String value) callApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) callApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) callJsonApi
(String url, String path) callJsonApi
(String url, String path, HttpApiClient.RequestOptions opts) callJsonApi
(String url, String path, HttpApiClient.RequestOptions opts, String method) callJsonApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) callJsonApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) ServiceResponse<org.apache.http.client.methods.CloseableHttpResponse>
callStreamApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) callXmlApi
(String url, String path, HttpApiClient.RequestOptions opts) callXmlApi
(String url, String path, HttpApiClient.RequestOptions opts, String method) callXmlApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) Deprecated.callXmlApi
(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) Deprecated.void
-
Field Details
-
throttleRate
Sets a throttle rate (in milliseconds) between HTTP Calls. This is used to slow down queries to the remote server. -
networkProxy
-
log
protected static org.slf4j.Logger log
-
-
Constructor Details
-
HttpApiClient
public HttpApiClient()
-
-
Method Details
-
callApi
public ServiceResponse callApi(String url, String path, String username, String password) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callApi
public ServiceResponse callApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callApi
public ServiceResponse callApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callStreamApi
public ServiceResponse<org.apache.http.client.methods.CloseableHttpResponse> callStreamApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
- Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callJsonApi
public ServiceResponse callJsonApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callXmlApi
public ServiceResponse callXmlApi(String url, String path, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callXmlApi
public ServiceResponse callXmlApi(String url, String path, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception - Throws:
URISyntaxException
Exception
-
callXmlApi
@Deprecated(since="1.1.5") public ServiceResponse callXmlApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts) throws URISyntaxException, Exception Deprecated.- Throws:
URISyntaxException
Exception
-
callXmlApi
@Deprecated(since="1.1.5") public ServiceResponse callXmlApi(String url, String path, String username, String password, HttpApiClient.RequestOptions opts, String method) throws URISyntaxException, Exception Deprecated.- Throws:
URISyntaxException
Exception
-
addRequiredHeader
public Map<CharSequence,CharSequence> addRequiredHeader(Map<CharSequence, CharSequence> headers, String name, String value) -
shutdownClient
public void shutdownClient()
-