Class ActionRateLimiter


  • public final class ActionRateLimiter
    extends Object
    This class is for limiting the request and can be used in action classes.
    Since:
    8.7
    • Constructor Summary

      Constructors 
      Constructor Description
      ActionRateLimiter​(@NonNull String permitsPerSecondKey, @org.checkerframework.checker.nullness.qual.NonNull double defaultPermitsPerSecond, @NonNull String permitsPerSecondGlobalKey, @org.checkerframework.checker.nullness.qual.NonNull double defaultPermitsPerSecondGlobal, @NonNull String cacheExpiryLimitKey, @org.checkerframework.checker.nullness.qual.NonNull long defaultCacheExpiryLimit)
      This constructor is used to pass the system props and default value at the time of bean initialisation.
    • Constructor Detail

      • ActionRateLimiter

        public ActionRateLimiter​(@NonNull String permitsPerSecondKey,
                                 @org.checkerframework.checker.nullness.qual.NonNull double defaultPermitsPerSecond,
                                 @NonNull String permitsPerSecondGlobalKey,
                                 @org.checkerframework.checker.nullness.qual.NonNull double defaultPermitsPerSecondGlobal,
                                 @NonNull String cacheExpiryLimitKey,
                                 @org.checkerframework.checker.nullness.qual.NonNull long defaultCacheExpiryLimit)
        This constructor is used to pass the system props and default value at the time of bean initialisation. Multiple instances can be created with multiple default values as per action/functionality requirement in settingsContext.xml
    • Method Detail

      • isRequestAllowed

        public String isRequestAllowed​(String usernameOrEmail,
                                       String actionId)
        Fetch the ratelimiter by userName or email for any actionId and returns the action result.
        Parameters:
        usernameOrEmail -
        Returns:
        action result page