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

public Class ResponseRateLimitingHandler

extends Object
implements HttpHandler
Class Inheritance
All Implemented Interfaces
io.undertow.server.HttpHandler
Imports
io.undertow.conduits.RateLimitingStreamSinkConduit, io.undertow.server.ConduitWrapper, .HandlerWrapper, .HttpHandler, .HttpServerExchange, io.undertow.server.handlers.builder.HandlerBuilder, io.undertow.util.ConduitFactory, org.xnio.conduits.StreamSinkConduit, java.util.Arrays, .HashMap, .HashSet, .Map, .Set, java.util.concurrent.TimeUnit

Handler that limits the download rate
Author
Stuart Douglas

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 int
private final HttpHandler
private final long
private final ConduitWrapper<StreamSinkConduit>

Constructor Summary

AccessConstructor and Description
public
ResponseRateLimitingHandler(HttpHandler
The next handler
next
,
int
The number of bytes per time period
bytes
,
long
The time period
time
,
TimeUnit
The units of the time period
timeUnit
)

A handler that limits the download speed to a set number of bytes/period

Method Summary

Modifier and TypeMethod and Description
public void
handleRequest(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

bytesback to summary
private final int bytes
nextback to summary
private final HttpHandler next
timeback to summary
private final long time
WRAPPERback to summary
private final ConduitWrapper<StreamSinkConduit> WRAPPER

Constructor Detail

ResponseRateLimitingHandlerback to summary
public ResponseRateLimitingHandler(HttpHandler next, int bytes, long time, TimeUnit timeUnit)

A handler that limits the download speed to a set number of bytes/period

Parameters
next:HttpHandler

The next handler

bytes:int

The number of bytes per time period

time:long

The time period

timeUnit:TimeUnit

The units of the time period

Method Detail

handleRequestback to summary
public void handleRequest(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

Annotations
@Override
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 ResponseRateLimitingHandler.Builder

extends Object
implements HandlerBuilder
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.ResponseRateLimitingHandler.Builder
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 ResponseRateLimitingHandler.Wrapper

extends Object
implements HandlerWrapper
Class Inheritance
  • java.lang.Object
  • io.undertow.server.handlers.ResponseRateLimitingHandler.Wrapper
All Implemented Interfaces
io.undertow.server.HandlerWrapper

Field Summary

Modifier and TypeField and Description
private final int
private final long

Constructor Summary

AccessConstructor and Description
private
Wrapper(int bytes, long time, TimeUnit timeUnit)

Method Summary

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

Field Detail

bytesback to summary
private final int bytes
timeback to summary
private final long time

Constructor Detail

Wrapperback to summary
private Wrapper(int bytes, long time, TimeUnit timeUnit)

Method Detail

wrapback to summary
public HttpHandler wrap(HttpHandler handler)

Implements io.undertow.server.HandlerWrapper.wrap.

Annotations
@Override