Package org.apache.catalina.util
Interface RateLimiter
- All Known Implementing Classes:
- FastRateLimiter
public interface RateLimiter
- 
Method SummaryModifier and TypeMethodDescriptionvoiddestroy()Cleanup no longer needed resources.intdefault Stringdefault StringgetQuota(int requestCount) Provide the quota header for this rate limit for a given request count within the current time window.intintIncrements the number of requests by the given ipAddress in the current time window.voidsetDuration(int duration) Sets the configured duration value in seconds.voidsetFilterConfig(FilterConfig filterConfig) Pass the FilterConfig to configure the filter.voidsetPolicyName(String name) Sets the policy name, otherwise an auto-generated name is used.voidsetRequests(int requests) Sets the configured number of requests allowed per time window.
- 
Method Details- 
getDurationint getDuration()- Returns:
- the actual duration of a time window in seconds
 
- 
setDurationvoid setDuration(int duration) Sets the configured duration value in seconds.- Parameters:
- duration- The duration of the time window in seconds
 
- 
getRequestsint getRequests()- Returns:
- the maximum number of requests allowed per time window
 
- 
setRequestsvoid setRequests(int requests) Sets the configured number of requests allowed per time window.- Parameters:
- requests- The number of requests per time window
 
- 
incrementIncrements the number of requests by the given ipAddress in the current time window.- Parameters:
- ipAddress- the ip address
- Returns:
- the new value after incrementing
 
- 
destroyvoid destroy()Cleanup no longer needed resources.
- 
setFilterConfigPass the FilterConfig to configure the filter.- Parameters:
- filterConfig- The FilterConfig used to configure the associated filter
 
- 
getPolicyNameString getPolicyName()- Returns:
- name of RateLimit policy
 
- 
setPolicyNameSets the policy name, otherwise an auto-generated name is used.- Parameters:
- name- of rate limit policy
 
- 
getPolicy- Returns:
- full representation of current policy
- See Also:
 
- 
getQuotaProvide the quota header for this rate limit for a given request count within the current time window.- Parameters:
- requestCount- The request count within the current time window
- Returns:
- the quota header for the given value of request count
- See Also:
 
 
-