io.undertow.server.handlers

## Class RequestLimitingHandler

- java.lang.Object
- - io.undertow.server.handlers.RequestLimitingHandler

All Implemented Interfaces:
  HttpHandler

    public final class RequestLimitingHandler
    extends Object
    implements HttpHandler

A handler which limits the maximum number of concurrent requests. Requests beyond the limit will block until the previous request is complete.

Author:
  David M. Lloyd

### Nested Class Summary

Nested Classes
`static class` `RequestLimitingHandler.Builder`

### Constructor Summary

Constructors
Constructor and Description
`RequestLimitingHandler(int maximumConcurrentRequests, HttpHandler nextHandler)` Construct a new instance.
`RequestLimitingHandler(int maximumConcurrentRequests, int queueSize, HttpHandler nextHandler)` Construct a new instance.
`RequestLimitingHandler(RequestLimit requestLimit, HttpHandler nextHandler)` Construct a new instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`RequestLimit` `getRequestLimit()`
`void` `handleRequest(HttpServerExchange exchange)` Handle the request.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### RequestLimitingHandler

    public RequestLimitingHandler(int maximumConcurrentRequests,
                                  HttpHandler nextHandler)

Construct a new instance. The maximum number of concurrent requests must be at least one. The next handler must not be `null`.

Parameters:
  `maximumConcurrentRequests` - the maximum concurrent requests
  `nextHandler` - the next handler

#### RequestLimitingHandler

    public RequestLimitingHandler(int maximumConcurrentRequests,
                                  int queueSize,
                                  HttpHandler nextHandler)

Construct a new instance. The maximum number of concurrent requests must be at least one. The next handler must not be `null`.

Parameters:
  `maximumConcurrentRequests` - the maximum concurrent requests
  `queueSize` - the maximum number of requests to queue
  `nextHandler` - the next handler

#### RequestLimitingHandler

    public RequestLimitingHandler(RequestLimit requestLimit,
                                  HttpHandler nextHandler)

Construct a new instance. This version takes a `RequestLimit` directly which may be shared with other handlers.

Parameters:
  `requestLimit` - the request limit information.
  `nextHandler` - the next handler

### Method Detail

#### handleRequest

    public void handleRequest(HttpServerExchange exchange)
                       throws Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`

#### getRequestLimit

    public RequestLimit getRequestLimit()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`