Class DefaultRateThrottlingPolicy
- java.lang.Object
-
- org.forgerock.http.filter.throttling.DefaultRateThrottlingPolicy
-
- All Implemented Interfaces:
ThrottlingPolicy
public class DefaultRateThrottlingPolicy extends Object implements ThrottlingPolicy
ADefaultRateThrottlingPolicyis a delegatingThrottlingPolicythat ensures the returnedThrottlingRateis never null. If the delegatedThrottlingPolicyreturnsnull, then it returns the specified default rate.
-
-
Constructor Summary
Constructors Constructor Description DefaultRateThrottlingPolicy(ThrottlingRate defaultRate, ThrottlingPolicy delegate)Constructs a newDefaultRateThrottlingPolicy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.forgerock.util.promise.Promise<ThrottlingRate,Exception>lookup(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request)Returns theThrottlingRatethat should be used for the provided request.
-
-
-
Constructor Detail
-
DefaultRateThrottlingPolicy
public DefaultRateThrottlingPolicy(ThrottlingRate defaultRate, ThrottlingPolicy delegate)
Constructs a newDefaultRateThrottlingPolicy.- Parameters:
defaultRate- the rate to return if the one returned by the delegate is null.delegate- the wrapped datasource to execute
-
-
Method Detail
-
lookup
public org.forgerock.util.promise.Promise<ThrottlingRate,Exception> lookup(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request)
Description copied from interface:ThrottlingPolicyReturns theThrottlingRatethat should be used for the provided request.- Specified by:
lookupin interfaceThrottlingPolicy- Parameters:
context- The current context which might be used to retrieve the throttling rate.request- The current request which might be used to retrieve the throttling rate.- Returns:
- A
Promiserepresenting theThrottlingRatethat should be used for the request.
-
-