Package io.undertow.server.handlers
Class RequestLimitingHandler
- java.lang.Object
-
- io.undertow.server.handlers.RequestLimitingHandler
-
- All Implemented Interfaces:
HttpHandler
public final class RequestLimitingHandler extends java.lang.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 classRequestLimitingHandler.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 RequestLimitgetRequestLimit()voidhandleRequest(HttpServerExchange exchange)Handle the request.java.lang.StringtoString()
-
-
-
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 aRequestLimitdirectly 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 java.lang.Exception
Description copied from interface:HttpHandlerHandle the request.- Specified by:
handleRequestin interfaceHttpHandler- Parameters:
exchange- the HTTP request/response exchange- Throws:
java.lang.Exception
-
getRequestLimit
public RequestLimit getRequestLimit()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-