
public.javadoc.org.spincast.plugins.attemptslimiter.AttemptsManagerDefault.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
AttemptsManagerDefault (org.spincast:spincast-framework 1.14.0 API)
org.spincast.plugins.attemptslimiter
Class AttemptsManagerDefault
- java.lang.Object
-
- org.spincast.plugins.attemptslimiter.AttemptsManagerDefault
-
- All Implemented Interfaces:
- AttemptsManager
public class AttemptsManagerDefault
extends Object
implements AttemptsManager
-
-
Field Summary
Fields
Modifier and Type
Field and Description
protected static org.slf4j.Logger
logger
-
Constructor Summary
Constructors
Constructor and Description
AttemptsManagerDefault(SpincastAttemptsLimiterPluginRepository SpincastAttemptsLimiterPluginRepository,
AttemptFactory attemptFactory,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
Attempt
attempt(String actionName,
AttemptCriteria... criterias)
Gets the current Attempt
, given the action to protect
and criterias.
Attempt
attempt(String actionName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
Gets the current Attempt
, given the action to protect
and criterias.
protected AttemptFactory
getAttemptFactory()
protected AttemptRule
getAttemptRule(String actionName)
Map<String,AttemptRule>
getAttemptRulesByActionName()
Gets all the registered AttemptRule
rules,
by action names.
protected SpincastAttemptsLimiterPluginConfig
getSpincastAttemptsLimiterPluginConfig()
protected SpincastAttemptsLimiterPluginRepository
getSpincastAttemptsLimiterPluginRepository()
void
registerAttempRule(AttemptRule attemptRule)
Registers a AttemptRule
rule.
void
registerAttempRule(String actionName,
int nbrMaxAttemptsPerDuration,
Duration duration)
Creates and registers a AttemptRule
rule from the required informations.
-
-
Constructor Detail
-
AttemptsManagerDefault
@Inject
public AttemptsManagerDefault(SpincastAttemptsLimiterPluginRepository SpincastAttemptsLimiterPluginRepository,
AttemptFactory attemptFactory,
SpincastAttemptsLimiterPluginConfig spincastAttemptsLimiterPluginConfig)
-
Method Detail
-
getSpincastAttemptsLimiterPluginRepository
protected SpincastAttemptsLimiterPluginRepository getSpincastAttemptsLimiterPluginRepository()
-
getAttemptRulesByActionName
public Map<String,AttemptRule> getAttemptRulesByActionName()
Description copied from interface: AttemptsManager
Gets all the registered AttemptRule
rules,
by action names.
- Specified by:
getAttemptRulesByActionName
in interface AttemptsManager
-
getAttemptRule
protected AttemptRule getAttemptRule(String actionName)
-
getAttemptFactory
protected AttemptFactory getAttemptFactory()
-
getSpincastAttemptsLimiterPluginConfig
protected SpincastAttemptsLimiterPluginConfig getSpincastAttemptsLimiterPluginConfig()
-
attempt
public Attempt attempt(String actionName,
AttemptCriteria... criterias)
Description copied from interface: AttemptsManager
Gets the current Attempt
, given the action to protect
and criterias. With this object you can:
-
Know if the action should be allowed or blocked,
by calling
Attempt.isMaxReached()
.
-
Manually increment the number of attempts using
Attempt.incrementAttemptsCount()
,
if you didn't let the {AttemptsManager.attempt(String, AttemptCriteria...)
} method do
it automatically
(see SpincastAttemptsLimiterPluginConfig.getDefaultAttemptAutoIncrementType()
).
- Specified by:
attempt
in interface AttemptsManager
-
attempt
public Attempt attempt(String actionName,
AttemptsAutoIncrementType attemptsAutoIncrementType,
AttemptCriteria... criterias)
Description copied from interface: AttemptsManager
Gets the current Attempt
, given the action to protect
and criterias. With this object you can:
-
Know if the action should be allowed or blocked,
by calling
Attempt.isMaxReached()
.
-
Manually increment the number of attempts using
Attempt.incrementAttemptsCount()
,
if you didn't let the {#attempt(String, AttemptAutoIncrementType, AttemptCriteria...))
} method do
it automatically.
- Specified by:
attempt
in interface AttemptsManager
attemptsAutoIncrementType
- Specifies if the method should increment the
number of attempts by itself. If you don't let it do it, you need to increment
the number of attempts by yourself, by calling Attempt.incrementAttemptsCount()
on the returned object.
-
registerAttempRule
public void registerAttempRule(AttemptRule attemptRule)
Description copied from interface: AttemptsManager
Registers a AttemptRule
rule.
- Specified by:
registerAttempRule
in interface AttemptsManager
-
registerAttempRule
public void registerAttempRule(String actionName,
int nbrMaxAttemptsPerDuration,
Duration duration)
Description copied from interface: AttemptsManager
Creates and registers a AttemptRule
rule from the required informations.
- Specified by:
registerAttempRule
in interface AttemptsManager
Copyright © 2019. All rights reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy