Class FlowDauIntegration

java.lang.Object
com.vaadin.flow.server.dau.FlowDauIntegration

public final class FlowDauIntegration extends Object
A utility class for various daily active users collecting methods.

For internal use only. May be renamed or removed in a future release.

Since:
24.5
  • Method Details

    • generateNewCookie

      public static jakarta.servlet.http.Cookie generateNewCookie(VaadinRequest request)
      Generates a new cookie for counting daily active users within 24 hour time interval.

      Cookie value is formatted as trackingHash$creationTime, with creationTime expressed as number of milliseconds from the epoch of 1970-01-01T00:00:00Z. The cookie creation time is required on subsequent requests to detect active users. By default, the cookie expires after 24 hours.
      Parameters:
      request - http request from browser
      Returns:
      http cookie to be used to count application's end-users daily
    • applyEnforcement

      public static void applyEnforcement(VaadinRequest request, Predicate<VaadinRequest> enforceableRequest)
      Potentially applies enforcement to the current request if DAU limit is exceeded.

      If enforcement has to be applied an EnforcementException is thrown.
      Parameters:
      request - the Vaadin request
      enforceableRequest - predicate to check if the request can be blocked or not.
      Throws:
      DauEnforcementException - if request must be blocked because of DAU limit exceeded.