An open API service indexing awesome lists of open source software.

https://github.com/ggrandes/concurrentlimit-servlet-filter

Concurrent Limit Servlet Filter for a container like Tomcat
https://github.com/ggrandes/concurrentlimit-servlet-filter

concurrent filter http ip java limit request servlet tomcat

Last synced: 23 days ago
JSON representation

Concurrent Limit Servlet Filter for a container like Tomcat

Awesome Lists containing this project

README

          

# Concurrent Limit Servlet Filter

Provides concurrent control in a Servlet container like Tomcat. Open Source Java project under Apache License v2.0

### Current Development Version is [2.0.0](https://search.maven.org/#search|ga|1|g%3Aorg.javastack%20a%3Aconcurrentlimit-servlet-filter-jakarta)

---

## DOC

This filter works limiting access for specified URI.

1. Check if the IP has been seen in the last X milliseconds.
2. If not seen, try to acquire access (concurrent) for resource.
3. If any of this checks fail, HTTP code 429 (Too Many Requests) is returned to the client as described in [RFC-6585](http://tools.ietf.org/html/rfc6585#page-3).

#### Usage Example

```xml

ConcurrentLimitFilter
org.javastack.servlet.filters.ConcurrentLimitFilter


/rest/update

5:5000



/rest/delete
0:1000



ipMaxSize
4096

ConcurrentLimitFilter
/rest/*

```

---

## MAVEN

Add the dependency to your pom.xml:

###### jakarta.servlet (tomcat 10+)


org.javastack
concurrentlimit-servlet-filter-jakarta
2.0.0

###### javax.servlet (tomcat 8.5, 9)


org.javastack
concurrentlimit-servlet-filter
1.0.0

---
Inspired in [mod_ratelimit](https://httpd.apache.org/docs/2.4/es/mod/mod_ratelimit.html), this code is Java-minimalistic version.