apispark

Limit request on a Restlet resource with APISpark restlet extension

余生颓废 提交于 2019-12-02 17:38:27
问题 Here's my code to limit the number of request for minute: MethodAuthorizer ma = createMethodAuthorizer(); ma.setNext(router); FirewallRule rule = new PeriodicFirewallCounterRule(60, TimeUnit.SECONDS, new IpAddressCountingPolicy()); ((PeriodicFirewallCounterRule)rule).addHandler(new RateLimitationHandler(new UniqueLimitPolicy(10))); FirewallFilter firewallFiler = new FirewallFilter(getContext(), list(rule)); firewallFiler.setNext(ma); return ma; The problem is that there is no error, but even

Limit request on a Restlet resource with APISpark restlet extension

狂风中的少年 提交于 2019-12-02 11:15:32
Here's my code to limit the number of request for minute: MethodAuthorizer ma = createMethodAuthorizer(); ma.setNext(router); FirewallRule rule = new PeriodicFirewallCounterRule(60, TimeUnit.SECONDS, new IpAddressCountingPolicy()); ((PeriodicFirewallCounterRule)rule).addHandler(new RateLimitationHandler(new UniqueLimitPolicy(10))); FirewallFilter firewallFiler = new FirewallFilter(getContext(), list(rule)); firewallFiler.setNext(ma); return ma; The problem is that there is no error, but even if more than 10 request is requested from the resource still it does not throw "Too Many Request" I

NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch

泄露秘密 提交于 2019-11-29 14:07:53
My app is throwing NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch error. Not sure why, because 16.0.1 do contain that class, I've checked. From what I have researched, it looks like this is a bug? I also have this code for refernence, though I think this is not the issue: FirewallRule rule = new PeriodicFirewallCounterRule(60, TimeUnit.SECONDS, new IpAddressCountingPolicy()); ((PeriodicFirewallCounterRule)rule).addHandler(new RateLimitationHandler(new UniqueLimitPolicy(10))); FirewallFilter firewallFiler = new FirewallFilter(getContext(),

NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch

心不动则不痛 提交于 2019-11-28 07:39:36
问题 My app is throwing NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch error. Not sure why, because 16.0.1 do contain that class, I've checked. From what I have researched, it looks like this is a bug? I also have this code for refernence, though I think this is not the issue: FirewallRule rule = new PeriodicFirewallCounterRule(60, TimeUnit.SECONDS, new IpAddressCountingPolicy()); ((PeriodicFirewallCounterRule)rule).addHandler(new