Package com.exedio.cops
Class RequestLimiter
java.lang.Object
com.exedio.cops.RequestLimiter
-
Constructor Summary
ConstructorsConstructorDescriptionRequestLimiter(int threshold, int interval, String denyMessage) RequestLimiter(int threshold, int interval, String denyMessage, String denyBody) -
Method Summary
Modifier and TypeMethodDescriptionbooleandoRequest(HttpServletRequest request, HttpServletResponse response) voidinit(ServletConfig config)
-
Constructor Details
-
RequestLimiter
- Parameters:
threshold- the number of request allowed in one interval, until further requests in that interval are deniedinterval- the length of the interval in milliseconds
-
RequestLimiter
- Parameters:
threshold- the number of request allowed in one interval, until further requests in that interval are deniedinterval- the length of the interval in milliseconds
-
-
Method Details
-
init
-
doRequest
public boolean doRequest(HttpServletRequest request, HttpServletResponse response) throws IOException - Returns:
- whether this call has handled the request.
Do the following at the beginning of processing the request:
if(requestLimiter.doRequest(request, response)) return; - Throws:
IOException
-