Package org.dspace.matomo.client
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
abstract client for Matomo integration- Author:
- Vincenzo Mecca (vins01-4science - vincenzo.mecca at 4science.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final Cprotected final org.apache.logging.log4j.Loggerprotected final MatomoRequestBuilderprotected final MatomoResponseReaderprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionMatomoAbstractClient(String baseUrl, String token, MatomoRequestBuilder matomoRequestBuilder, MatomoResponseReader matomoResponseReader, C httpClient) -
Method Summary
Modifier and TypeMethodDescriptionprotected TcreateRequest(String requestBody) Creates a request with the given request body and empty cookies.protected abstract TcreateRequest(String requestBody, String cookies) protected StringcreateRequestBody(List<MatomoRequestDetails> details) protected abstract voidexecuteRequest(String requestBody, String cookies, BiConsumer<U, String> responseConsumer) protected StringformatErrorMessage(U response) protected StringgenerateCookies(List<MatomoRequestDetails> details) Generates a cookie string from a list of Matomo request details.protected abstract StringgetResponseContent(U response) protected abstract intgetStatusCode(U response) protected booleanisNotSuccessful(U response) protected voidvoidsendDetails(List<MatomoRequestDetails> details) This method is an overload of thesendDetailsabovevoidsendDetails(MatomoRequestDetails... details) This method sends tracked resources to Matomo Tracking API
-
Field Details
-
baseUrl
-
token
-
matomoRequestBuilder
-
matomoResponseReader
-
httpClient
-
log
protected final org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
MatomoAbstractClient
public MatomoAbstractClient(String baseUrl, String token, MatomoRequestBuilder matomoRequestBuilder, MatomoResponseReader matomoResponseReader, C httpClient)
-
-
Method Details
-
createRequest
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
-
executeRequest
protected abstract void executeRequest(String requestBody, String cookies, BiConsumer<U, String> responseConsumer) -
getStatusCode
-
getResponseContent
-
sendDetails
Description copied from interface:MatomoClientThis method sends tracked resources to Matomo Tracking API- Specified by:
sendDetailsin interfaceMatomoClient
-
createRequestBody
-
sendDetails
Description copied from interface:MatomoClientThis method is an overload of thesendDetailsabove- Specified by:
sendDetailsin interfaceMatomoClient
-
generateCookies
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
-
isNotSuccessful
-
formatErrorMessage
-