Top Description Inners Fields Constructors Methods
io.undertow.server.handlers

public final Class RequestLimitingHandler

extends Object
implements HttpHandler
Class Inheritance
All Implemented Interfaces
io.undertow.server.HttpHandler
Static Imports
org.wildfly.common.Assert.checkNotNullParam

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 and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class

Field Summary

Modifier and TypeField and Description
private final HttpHandler
private final RequestLimit

Constructor Summary

AccessConstructor and Description
public
RequestLimitingHandler(int
the maximum concurrent requests
maximumConcurrentRequests
,
HttpHandler
the next handler
nextHandler
)

Construct a new instance.

public
RequestLimitingHandler(int
the maximum concurrent requests
maximumConcurrentRequests
,
int
the maximum number of requests to queue
queueSize
,
HttpHandler
the next handler
nextHandler
)

Construct a new instance.

public
RequestLimitingHandler(RequestLimit
the request limit information.
requestLimit
,
HttpHandler
the next handler
nextHandler
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public RequestLimit
public void
handleRequest(final HttpServerExchange
the HTTP request/response exchange
exchange
)

Implements io.undertow.server.HttpHandler.handleRequest.

Handle the request.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

nextHandlerback to summary
private final HttpHandler nextHandler
requestLimitback to summary
private final RequestLimit requestLimit

Constructor Detail

RequestLimitingHandlerback to summary
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:int

the maximum concurrent requests

nextHandler:HttpHandler

the next handler

RequestLimitingHandlerback to summary
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:int

the maximum concurrent requests

queueSize:int

the maximum number of requests to queue

nextHandler:HttpHandler

the next handler

RequestLimitingHandlerback to summary
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:RequestLimit

the request limit information.

nextHandler:HttpHandler

the next handler

Method Detail

getRequestLimitback to summary
public RequestLimit getRequestLimit()
handleRequestback to summary
public void handleRequest(final HttpServerExchange exchange) throws Exception

Implements io.undertow.server.HttpHandler.handleRequest.

Doc from io.undertow.server.HttpHandler.handleRequest.

Handle the request.

Parameters
exchange:HttpServerExchange

the HTTP request/response exchange

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
io.undertow.server.handlers back to summary

public Class RequestLimitingHandler.Builder

extends Object
implements HandlerBuilder
Class Inheritance
All Implemented Interfaces
io.undertow.server.handlers.builder.HandlerBuilder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HandlerWrapper
build(Map<String, Object>
The handler config
config
)

Implements io.undertow.server.handlers.builder.HandlerBuilder.build.

Creates the handler

public String
public String
name()

Implements io.undertow.server.handlers.builder.HandlerBuilder.name.

The string representation of the handler name.

public Map<String, Class<?>>
parameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Returns a map of parameters and their types.

public Set<String>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Builderback to summary
public Builder()

Method Detail

buildback to summary
public HandlerWrapper build(Map<String, Object> config)

Implements io.undertow.server.handlers.builder.HandlerBuilder.build.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.build.

Creates the handler

Parameters
config:Map<String, Object>

The handler config

Returns:HandlerWrapper

The new predicate

Annotations
@Override
defaultParameterback to summary
public String defaultParameter()

Implements io.undertow.server.handlers.builder.HandlerBuilder.defaultParameter.

Returns:String

Doc from io.undertow.server.handlers.builder.HandlerBuilder.defaultParameter.

The default parameter name, or null if it does not have a default parameter

Annotations
@Override
nameback to summary
public String name()

Implements io.undertow.server.handlers.builder.HandlerBuilder.name.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.name.

The string representation of the handler name.

Returns:String

The handler name

Annotations
@Override
parametersback to summary
public Map<String, Class<?>> parameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Doc from io.undertow.server.handlers.builder.HandlerBuilder.parameters.

Returns a map of parameters and their types.

Annotations
@Override
requiredParametersback to summary
public Set<String> requiredParameters()

Implements io.undertow.server.handlers.builder.HandlerBuilder.requiredParameters.

Returns:Set<String>

Doc from io.undertow.server.handlers.builder.HandlerBuilder.requiredParameters.

The required parameters

Annotations
@Override
io.undertow.server.handlers back to summary

private Class RequestLimitingHandler.Wrapper

extends Object
implements HandlerWrapper
Class Inheritance
All Implemented Interfaces
io.undertow.server.HandlerWrapper

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
private
Wrapper(int requests)

Method Summary

Modifier and TypeMethod and Description
public HttpHandler
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

requestsback to summary
private final int requests

Constructor Detail

Wrapperback to summary
private Wrapper(int requests)

Method Detail

wrapback to summary
public HttpHandler wrap(HttpHandler handler)

Implements io.undertow.server.HandlerWrapper.wrap.

Annotations
@Override