alwaysThrottleParam| Constructor and Description |
|---|
BanThrottler(Callable<S> createThrottlingState,
com.google.common.cache.Cache<Object,S> stateStore,
String enableThrottlingIfHeader,
String alwaysBanParam,
Clock clock)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Instant |
internalThrottledUntil(Object bucket,
javax.servlet.http.HttpServletRequest request)
Implemented by clients for the specific throttling logic.
|
void |
throttled(Object bucket,
javax.servlet.http.HttpServletRequest request)
Should be called each time a request is throttled.
|
getState, getStateIfPresent, shouldBypassThrottling, throttledDuration, throttledUntilpublic BanThrottler(Callable<S> createThrottlingState, com.google.common.cache.Cache<Object,S> stateStore, String enableThrottlingIfHeader, String alwaysBanParam, Clock clock)
Note that a bucket represent our approximation of a single client.
createThrottlingState - how to create the initial throttling state
when we start tracking a specific clientstateStore - the cache in which we store the per client state of
throttlingenableThrottlingIfHeader - throttling is only enabled if this header is presentalwaysBanParam - this query parameter will cause banning no matter whatprotected Instant internalThrottledUntil(Object bucket, javax.servlet.http.HttpServletRequest request)
ThrottlerinternalThrottledUntil in class Throttler<S extends BanState>Throttler.throttledUntil(Object, HttpServletRequest)public void throttled(Object bucket, javax.servlet.http.HttpServletRequest request)
bucket - the bucket to which this request belongsrequest - the request being throttledCopyright © 2019. All rights reserved.