Class MatomoAbstractClient<C,T,U>

java.lang.Object
org.dspace.matomo.client.MatomoAbstractClient<C,T,U>
All Implemented Interfaces:
MatomoClient
Direct Known Subclasses:
MatomoAsyncClientImpl, MatomoClientImpl

public abstract class MatomoAbstractClient<C,T,U> extends Object implements MatomoClient
abstract client for Matomo integration
Author:
Vincenzo Mecca (vins01-4science - vincenzo.mecca at 4science.com)
  • Field Details

    • baseUrl

      protected final String baseUrl
    • token

      protected final String token
    • matomoRequestBuilder

      protected final MatomoRequestBuilder matomoRequestBuilder
    • matomoResponseReader

      protected final MatomoResponseReader matomoResponseReader
    • httpClient

      protected final C httpClient
    • log

      protected final org.apache.logging.log4j.Logger log
  • Constructor Details

  • Method Details

    • createRequest

      protected T createRequest(String requestBody)
      Creates a request with the given request body and empty cookies.
      Parameters:
      requestBody - The body content of the request
      Returns:
      A request object of type T
    • createRequest

      protected abstract T createRequest(String requestBody, String cookies)
    • executeRequest

      protected abstract void executeRequest(String requestBody, String cookies, BiConsumer<U,String> responseConsumer)
    • getStatusCode

      protected abstract int getStatusCode(U response)
    • getResponseContent

      protected abstract String getResponseContent(U response)
    • sendDetails

      public void sendDetails(MatomoRequestDetails... details)
      Description copied from interface: MatomoClient
      This method sends tracked resources to Matomo Tracking API
      Specified by:
      sendDetails in interface MatomoClient
    • createRequestBody

      protected String createRequestBody(List<MatomoRequestDetails> details)
    • sendDetails

      public void sendDetails(List<MatomoRequestDetails> details)
      Description copied from interface: MatomoClient
      This method is an overload of the sendDetails above
      Specified by:
      sendDetails in interface MatomoClient
    • generateCookies

      protected String generateCookies(List<MatomoRequestDetails> details)
      Generates a cookie string from a list of Matomo request details.
      Parameters:
      details - List of MatomoRequestDetails to extract cookie information from
      Returns:
      String containing the formatted cookie data
    • logError

      protected void logError(U response, String requestBody)
    • isNotSuccessful

      protected boolean isNotSuccessful(U response)
    • formatErrorMessage

      protected String formatErrorMessage(U response)