Package 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 Modifier and Type Class Description static class
RequestLimitingHandler.Builder
-
Constructor Summary
Constructors Constructor Description RequestLimitingHandler(int maximumConcurrentRequests, int queueSize, HttpHandler nextHandler)
Construct a new instance.RequestLimitingHandler(int maximumConcurrentRequests, HttpHandler nextHandler)
Construct a new instance.RequestLimitingHandler(RequestLimit requestLimit, HttpHandler nextHandler)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestLimit
getRequestLimit()
void
handleRequest(HttpServerExchange exchange)
Handle the request.String
toString()
-
-
-
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 benull
.- Parameters:
maximumConcurrentRequests
- the maximum concurrent requestsnextHandler
- 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 benull
.- Parameters:
maximumConcurrentRequests
- the maximum concurrent requestsqueueSize
- the maximum number of requests to queuenextHandler
- the next handler
-
RequestLimitingHandler
public RequestLimitingHandler(RequestLimit requestLimit, HttpHandler nextHandler)
Construct a new instance. This version takes aRequestLimit
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 interfaceHttpHandler
- Parameters:
exchange
- the HTTP request/response exchange- Throws:
Exception
-
getRequestLimit
public RequestLimit getRequestLimit()
-
-