@ApplicationScoped public class DefaultRateLimitHandler extends RateLimitHandler
| Modifier and Type | Field and Description |
|---|---|
protected com.appslandia.common.base.RateLimit |
accessRate1 |
protected com.appslandia.common.base.RateLimit |
accessRate2 |
protected AppConfig |
appConfig |
protected com.appslandia.common.logging.AppLogger |
appLogger |
protected ConcurrentMap<String,Long> |
bannedClients |
protected long |
bannedResetWindow |
protected ConcurrentMap<String,com.appslandia.plum.defaults.DefaultRateLimitHandler.Tracker> |
clientTrackers |
static String |
CONFIG_ACCESS_RATE1 |
static String |
CONFIG_ACCESS_RATE2 |
static String |
CONFIG_BANNED_RESET_WINDOW |
static String |
CONFIG_MAX_ACCESSES |
protected javax.enterprise.concurrent.ManagedScheduledExecutorService |
executor |
protected long |
maxAccesses |
rateLimitSkipper| Constructor and Description |
|---|
DefaultRateLimitHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkClient(String clientId) |
void |
clearBannedClients() |
Map<String,Long> |
getBannedClients() |
Map<String,com.appslandia.plum.defaults.DefaultRateLimitHandler.Tracker> |
getClientTrackers() |
protected void |
init() |
checkRequestpublic static final String CONFIG_ACCESS_RATE1
public static final String CONFIG_ACCESS_RATE2
public static final String CONFIG_MAX_ACCESSES
public static final String CONFIG_BANNED_RESET_WINDOW
protected com.appslandia.common.base.RateLimit accessRate1
protected com.appslandia.common.base.RateLimit accessRate2
protected long maxAccesses
protected long bannedResetWindow
protected final ConcurrentMap<String,com.appslandia.plum.defaults.DefaultRateLimitHandler.Tracker> clientTrackers
protected final ConcurrentMap<String,Long> bannedClients
@Inject protected AppConfig appConfig
@Inject protected com.appslandia.common.logging.AppLogger appLogger
protected javax.enterprise.concurrent.ManagedScheduledExecutorService executor
protected void init()
throws Exception
init in class com.appslandia.common.base.InitializeObjectExceptionprotected void checkClient(String clientId) throws TooManyRequestsException
checkClient in class RateLimitHandlerTooManyRequestsExceptionpublic void clearBannedClients()
Copyright © 2021. All rights reserved.