Class ResponseRateLimitingHandler

  • All Implemented Interfaces:
    HttpHandler

    public class ResponseRateLimitingHandler
    extends java.lang.Object
    implements HttpHandler
    Handler that limits the download rate
    Author:
    Stuart Douglas
    • Constructor Detail

      • ResponseRateLimitingHandler

        public ResponseRateLimitingHandler​(HttpHandler next,
                                           int bytes,
                                           long time,
                                           java.util.concurrent.TimeUnit timeUnit)
        A handler that limits the download speed to a set number of bytes/period
        Parameters:
        next - The next handler
        bytes - The number of bytes per time period
        time - The time period
        timeUnit - The units of the time period
    • Method Detail

      • handleRequest

        public void handleRequest​(HttpServerExchange exchange)
                           throws java.lang.Exception
        Description copied from interface: HttpHandler
        Handle the request.
        Specified by:
        handleRequest in interface HttpHandler
        Parameters:
        exchange - the HTTP request/response exchange
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object