Class UsageStatisticsRecorder

java.lang.Object
io.goobi.viewer.model.statistics.usage.UsageStatisticsRecorder

public class UsageStatisticsRecorder extends Object
Class to be called on requests to be recorded in usage statistics. Stores and updates usage statistics in database on each request
Author:
florian
  • Constructor Details

    • UsageStatisticsRecorder

      public UsageStatisticsRecorder(IDAO dao, Configuration config, String viewerName)
      Default constructor
      Parameters:
      dao - the dao to set
      config - the config to set
      viewerName - the viewerName to set
  • Method Details

    • isActive

      public boolean isActive()
      Check if usage statistics are enabled by configuration
      Returns:
      true if Configuration.isStatisticsEnabled() returns true
    • recordRequest

      public void recordRequest(RequestType type, String recordIdentifier, javax.servlet.http.HttpServletRequest request)
      Add a http request to the usage statistics
      Parameters:
      type - the RequestType for which to count the request
      recordIdentifier - the record identifier requested by the request
      request - a HttpServletRequest
    • recordRequest

      protected void recordRequest(RequestType type, String recordIdentifier, String sessionID, String userAgent, String clientIP)
      Add a request to the internal request counts
      Parameters:
      type - the RequestType for which to count the request
      recordIdentifier - the record identifier requested by the request
      sessionID - The session issuing this request
      userAgent - the 'User-Agent' header value of the request
      clientIP - The IP Address from which the request is issued