Class SingleEndpointGoodDataRestProvider
java.lang.Object
com.gooddata.sdk.service.httpcomponents.SingleEndpointGoodDataRestProvider
- All Implemented Interfaces:
GoodDataRestProvider
- Direct Known Subclasses:
LoginPasswordGoodDataRestProvider,SstGoodDataRestProvider
public abstract class SingleEndpointGoodDataRestProvider
extends Object
implements GoodDataRestProvider
GoodDataRestProvider capable to be used with single API endpoint using the
Apache HttpClient to perform HTTP operations. It provides following functionality:
- Prepends the URI path with API endpoint (using
RestTemplateUriPrefixingClientHttpRequestFactory - Configures
ResponseErrorHandler - Configures connection according to
GoodDataSettings - Set default headers from
GoodDataSettingsincluding User-Agent - Configures retries in case it's requested
To provide complete implementation, this class must be extended and descendants should implement own logic by providing
GoodDataHttpClientBuilder to the constructor. Namely, the authentication logic remains to be provided by descendants.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GoodDataEndpointprotected org.apache.hc.client5.http.classic.HttpClientprotected org.springframework.web.client.RestTemplateprotected final GoodDataSettings -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSingleEndpointGoodDataRestProvider(GoodDataEndpoint endpoint, GoodDataSettings settings, GoodDataHttpClientBuilder builder) Creates new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.hc.client5.http.impl.classic.HttpClientBuildercreateHttpClientBuilder(GoodDataSettings settings) Creates http client builder, applying given settings.protected org.springframework.web.client.RestTemplatecreateRestTemplate(GoodDataEndpoint endpoint, GoodDataSettings settings, org.apache.hc.client5.http.classic.HttpClient httpClient) Creates configured REST templategetDataStoreService(Supplier<String> stagingUriSupplier) Configured DataStoreService if provided.org.apache.hc.client5.http.classic.HttpClientorg.springframework.web.client.RestTemplateConfigured RestTemplate instance.Settings used by the provider.
-
Field Details
-
endpoint
-
settings
-
httpClient
protected org.apache.hc.client5.http.classic.HttpClient httpClient -
restTemplate
protected org.springframework.web.client.RestTemplate restTemplate
-
-
Constructor Details
-
SingleEndpointGoodDataRestProvider
protected SingleEndpointGoodDataRestProvider(GoodDataEndpoint endpoint, GoodDataSettings settings, GoodDataHttpClientBuilder builder) Creates new instance.- Parameters:
endpoint- API endpointsettings- settingsbuilder- custom GoodData http client builder
-
-
Method Details
-
getRestTemplate
public org.springframework.web.client.RestTemplate getRestTemplate()Description copied from interface:GoodDataRestProviderConfigured RestTemplate instance.- Specified by:
getRestTemplatein interfaceGoodDataRestProvider- Returns:
- provided RestTemplate
-
getSettings
Description copied from interface:GoodDataRestProviderSettings used by the provider.- Specified by:
getSettingsin interfaceGoodDataRestProvider- Returns:
- used settings
-
getDataStoreService
Description copied from interface:GoodDataRestProviderConfigured DataStoreService if provided. By default empty.- Specified by:
getDataStoreServicein interfaceGoodDataRestProvider- Parameters:
stagingUriSupplier- supplier of the data store endpoint- Returns:
- dataStoreService (empty by default)
-
getEndpoint
- Returns:
- used API endpoint
-
getHttpClient
public org.apache.hc.client5.http.classic.HttpClient getHttpClient()- Returns:
- configured http client
-
createRestTemplate
protected org.springframework.web.client.RestTemplate createRestTemplate(GoodDataEndpoint endpoint, GoodDataSettings settings, org.apache.hc.client5.http.classic.HttpClient httpClient) Creates configured REST template- Parameters:
endpoint- API endpointsettings- settingshttpClient- http client to build RestTemplate on- Returns:
- configured REST template
-
createHttpClientBuilder
protected org.apache.hc.client5.http.impl.classic.HttpClientBuilder createHttpClientBuilder(GoodDataSettings settings) Creates http client builder, applying given settings.- Parameters:
settings- settings to apply- Returns:
- configured builder
-