com.caucho.filters
Class ThrottleFilter

java.lang.Object
  extended by com.caucho.filters.ThrottleFilter
All Implemented Interfaces:
Filter

public class ThrottleFilter
extends java.lang.Object
implements Filter

Throttles the filter to only a limited number of requests.


Constructor Summary
ThrottleFilter()
           
 
Method Summary
 void addPoisonedIp(java.lang.String address)
           
 void destroy()
          Any cleanup for the filter.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain nextFilter)
          doFilter performs the actual work of a filter, either modifying the request or the response.
static ThrottleFilter getCurrent()
           
 void init(FilterConfig config)
          Initialize the filter.
 void setDelay(Period period)
           
 void setMaxConcurrentRequests(int max)
          Sets the maximum number of concurrent requests for a single IP.
 void setMaxTotalRequests(int max)
           
 void setTimeout(Period period)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThrottleFilter

public ThrottleFilter()
Method Detail

getCurrent

public static ThrottleFilter getCurrent()

setMaxConcurrentRequests

public void setMaxConcurrentRequests(int max)
Sets the maximum number of concurrent requests for a single IP.


setMaxTotalRequests

public void setMaxTotalRequests(int max)

setTimeout

public void setTimeout(Period period)

setDelay

public void setDelay(Period period)

addPoisonedIp

public void addPoisonedIp(java.lang.String address)

init

public void init(FilterConfig config)
          throws ServletException
Description copied from interface: Filter
Initialize the filter.

Specified by:
init in interface Filter
Throws:
ServletException

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain nextFilter)
              throws ServletException,
                     java.io.IOException
Description copied from interface: Filter
doFilter performs the actual work of a filter, either modifying the request or the response. It will typically call the chain.doFilter() to invoke the next filter in the chain.

Specified by:
doFilter in interface Filter
Parameters:
request - the servlet request
response - the servlet response
nextFilter - the next filter in the chain
Throws:
ServletException
java.io.IOException

destroy

public void destroy()
Any cleanup for the filter.

Specified by:
destroy in interface Filter