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 GoodDataSettings including 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 Details

    • endpoint

      protected final GoodDataEndpoint endpoint
    • settings

      protected final GoodDataSettings 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 endpoint
      settings - settings
      builder - custom GoodData http client builder
  • Method Details

    • getRestTemplate

      public org.springframework.web.client.RestTemplate getRestTemplate()
      Description copied from interface: GoodDataRestProvider
      Configured RestTemplate instance.
      Specified by:
      getRestTemplate in interface GoodDataRestProvider
      Returns:
      provided RestTemplate
    • getSettings

      public GoodDataSettings getSettings()
      Description copied from interface: GoodDataRestProvider
      Settings used by the provider.
      Specified by:
      getSettings in interface GoodDataRestProvider
      Returns:
      used settings
    • getDataStoreService

      public Optional<DataStoreService> getDataStoreService(Supplier<String> stagingUriSupplier)
      Description copied from interface: GoodDataRestProvider
      Configured DataStoreService if provided. By default empty.
      Specified by:
      getDataStoreService in interface GoodDataRestProvider
      Parameters:
      stagingUriSupplier - supplier of the data store endpoint
      Returns:
      dataStoreService (empty by default)
    • getEndpoint

      public GoodDataEndpoint 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 endpoint
      settings - settings
      httpClient - 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