Top Description Constructors Methods
io.undertow

public Class Handlers

extends Object
Class Inheritance
Imports
io.undertow.attribute.ExchangeAttribute, io.undertow.predicate.Predicate, .PredicateParser, .PredicatesHandler, io.undertow.server.HttpHandler, .JvmRouteHandler, .RoutingHandler, io.undertow.server.handlers.SetErrorHandler, .AccessControlListHandler, .LearningPushHandler, .DateHandler, .DisableCacheHandler, .ExceptionHandler, .GracefulShutdownHandler, .HttpContinueAcceptingHandler, .HttpContinueReadHandler, .HttpTraceHandler, .IPAddressAccessControlHandler, .NameVirtualHostHandler, .PathHandler, .PathTemplateHandler, .PredicateContextHandler, .PredicateHandler, .ProxyPeerAddressHandler, .RedirectHandler, .RequestDumpingHandler, .RequestLimit, .RequestLimitingHandler, .ResponseRateLimitingHandler, .SetAttributeHandler, .SetHeaderHandler, .URLDecodingHandler, io.undertow.server.handlers.builder.PredicatedHandler, io.undertow.server.handlers.proxy.ProxyClient, .ProxyHandler, io.undertow.server.handlers.resource.ResourceHandler, .ResourceManager, io.undertow.server.handlers.sse.ServerSentEventConnectionCallback, .ServerSentEventHandler, io.undertow.websockets.WebSocketConnectionCallback, .WebSocketProtocolHandshakeHandler, java.util.List, java.util.concurrent.TimeUnit

Utility class with convenience methods for dealing with handlers
Author
Stuart Douglas

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static final AccessControlListHandler

Returns:

A new user agent access control handler
acl
(final HttpHandler
The next handler in the chain
next
,
boolean
Determine if a non-matching user agent will be allowed by default
defaultAllow
,
ExchangeAttribute attribute)

Returns a new handler that can allow or deny access to a resource based an at attribute of the exchange

public static DateHandler

Returns:

A new date handler
date
(final HttpHandler
The next handler in the chain
next
)
Deprecated

Returns a new HTTP handler that sets the Date: header.

public static HttpHandler

Returns:

The handler
disableCache
(final HttpHandler
The next handler
next
)

Handler that sets the headers that disable caching of the response

public static ExceptionHandler

Returns:

The exception handler
exceptionHandler
(final HttpHandler
The next handler
next
)

Returns a handler that maps exceptions to additional handlers

public static GracefulShutdownHandler

Returns:

The graceful shutdown handler
gracefulShutdown
(HttpHandler
The next http handler
next
)

Returns a new handler that can be used to wait for all requests to finish before shutting down the server gracefully.

public static void
handlerNotNull(final HttpHandler handler)

public static SetHeaderHandler

Returns:

A new set header handler
header
(final HttpHandler
The next handler in the chain
next
,
final String
The name of the header
headerName
,
final String
The header value
headerValue
)

Returns a handler that sets a response header

public static SetHeaderHandler

Returns:

A new set header handler
header
(final HttpHandler
The next handler in the chain
next
,
final String
The name of the header
headerName
,
final ExchangeAttribute
The header value
headerValue
)

Returns a handler that sets a response header

public static final HttpContinueAcceptingHandler

Returns:

The accepting handler
httpContinueAccepting
(final HttpHandler
The next handler
next
,
final Predicate
The predicate used to determine if the request should be accepted
accept
)

Returns a handler that sends back a HTTP 100 continue response if the given predicate resolves to true.

public static final HttpContinueAcceptingHandler

Returns:

The accepting handler
httpContinueAccepting
(final HttpHandler
The next handler
next
)

Returns a handler that sends back a HTTP 100 continue response to all requests.

public static final HttpContinueReadHandler

Returns:

A new continue handler
httpContinueRead
(final HttpHandler
The next handler in the chain
next
)

A handler that automatically handles HTTP 100-continue responses, by sending a continue response when the first attempt is made to read from the request channel.

public static final IPAddressAccessControlHandler

Returns:

A new IP access control handler
ipAccessControl
(final HttpHandler
The next handler in the chain
next
,
boolean
Determine if a non-matching address will be allowed by default
defaultAllow
)

Returns a new handler that can allow or deny access to a resource based on IP address

public static JvmRouteHandler

Returns:

The handler
jvmRoute
(final String
The session cookie name
sessionCookieName
,
final String
The JVM route to append
jvmRoute
,
HttpHandler
The next handler
next
)

Handler that appends the JVM route to the session cookie

public static LearningPushHandler

Returns:

A caching push handler
learningPushHandler
(int
The maximum number of entries to store
maxEntries
,
int
The maximum age of the entries
maxAge
,
HttpHandler
The next handler
next
)

Creates a handler that automatically learns which resources to push based on the referer header

public static LearningPushHandler

Returns:

A caching push handler
learningPushHandler
(int
The maximum number of entries to store
maxEntries
,
HttpHandler
The next handler
next
)

Creates a handler that automatically learns which resources to push based on the referer header

public static PathHandler

Returns:

A new path handler
path
(final HttpHandler
The default handler
defaultHandler
)

Creates a new path handler, with the default handler specified

public static PathHandler

Returns:

A new path handler
path
()

Creates a new path handler

public static PathTemplateHandler

Returns:

a new path template handler
pathTemplate
()

public static PathTemplateHandler

Returns:

The path template handler
pathTemplate
(boolean
If the query params should be rewritten
rewriteQueryParams
)

public static PredicateHandler

Returns:

A new predicate handler
predicate
(final Predicate
The predicate
predicate
,
final HttpHandler
The handler that will be executed if the predicate is true
trueHandler
,
final HttpHandler
The handler that will be exected if the predicate is false
falseHandler
)

Returns a new predicate handler, that will delegate to one of the two provided handlers based on the value of the provided predicate.

public static HttpHandler

Returns:

a handler that sets up a new predicate context
predicateContext
(HttpHandler
The next handler
next
)

public static PredicatesHandler
public static ProxyHandler

Returns:

The proxy handler
proxyHandler
(ProxyClient
The proxy client to use to connect to the remote server
proxyClient
,
int
The maximum amount of time a request can be in progress before it is forcibly closed
maxRequestTime
,
HttpHandler
The next handler to invoke if the proxy client does not know how to proxy the request
next
)

Returns a handler that can act as a load balancing reverse proxy.

public static ProxyHandler

Returns:

The proxy handler
proxyHandler
(ProxyClient
The proxy client to use to connect to the remote server
proxyClient
,
HttpHandler
The next handler to invoke if the proxy client does not know how to proxy the request
next
)

Returns a handler that can act as a load balancing reverse proxy.

public static ProxyHandler

Returns:

The proxy handler
proxyHandler
(ProxyClient
The proxy client to use to connect to the remote server
proxyClient
)

Returns a handler that can act as a load balancing reverse proxy.

public static ProxyPeerAddressHandler

Returns:

The handler
proxyPeerAddress
(HttpHandler
The next http handler
next
)

Returns a new handler that sets the peer address based on the X-Forwarded-For and X-Forwarded-Proto header

public static RedirectHandler

Returns:

A new redirect handler
redirect
(final String
The redirect location
location
)

Returns a new redirect handler

public static HttpHandler

Returns:

The request dumping handler
requestDump
(final HttpHandler
The next handler
next
)

Returns a handler that dumps requests to the log for debugging purposes.

public static RequestLimitingHandler

Returns:

The handler
requestLimitingHandler
(final int
The maximum number of requests
maxRequest
,
final int
The maximum number of queued requests
queueSize
,
HttpHandler
The next handler
next
)

Returns a handler that limits the maximum number of requests that can run at a time.

public static RequestLimitingHandler

Returns:

The handler
requestLimitingHandler
(final RequestLimit
The request limit object that can be shared between handlers, to apply the same limits across multiple handlers
requestLimit
,
HttpHandler
The next handler
next
)

Returns a handler that limits the maximum number of requests that can run at a time.

public static ResourceHandler

Returns:

A new resource handler
resource
(final ResourceManager
The resource manager to use
resourceManager
)

Return a new resource handler

public static ResponseRateLimitingHandler
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

public static HttpHandler
rewrite(final String
The rewrite condition
condition
,
final String
The rewrite target if the condition matches
target
,
final ClassLoader classLoader, final HttpHandler
The next handler
next
)

Creates the set of handlers that are required to perform a simple rewrite.

public static RoutingHandler

Returns:

The routing handler
routing
(boolean
If the query params should be rewritten
rewriteQueryParams
)

public static RoutingHandler

Returns:

a new routing handler
routing
()

public static ServerSentEventHandler

Returns:

A new server sent events handler
serverSentEvents
(ServerSentEventConnectionCallback
The server sent events callback
callback
)

A handler for server sent events

public static ServerSentEventHandler

Returns:

A new server sent events handler
serverSentEvents
()

A handler for server sent events

public static SetAttributeHandler

Returns:

The handler
setAttribute
(final HttpHandler
The next handler
next
,
final String
The attribute to set, specified as a string presentation of an io.undertow.attribute.ExchangeAttribute
attribute
,
final String
The value to set, specified an a string representation of an io.undertow.attribute.ExchangeAttribute
value
,
final ClassLoader
The class loader to use to parser the exchange attributes
classLoader
)

Returns an attribute setting handler that can be used to set an arbitrary attribute on the exchange.

public static SetErrorHandler

Returns:

A Set Error handler
setErrorHandler
(int
The response code to set
responseCode
,
HttpHandler
The next handler
next
)

A handler that sets response code but continues the exchange so the servlet's error page can be returned.

public static HttpTraceHandler

Returns:

A HTTP trace handler
trace
(final HttpHandler
The next handler in the chain
next
)

Returns a new HTTP trace handler.

public static final URLDecodingHandler

Returns:

a new url decoding handler
urlDecoding
(final HttpHandler
The next handler in the chain
next
,
final String
The charset to decode to
charset
)

A handler that will decode the URL, query parameters and to the specified charset.

public static HttpHandler

Returns:

A handler that decodes the URL
urlDecodingHandler
(final String
The charset to decode
charset
,
final HttpHandler
The next handler
next
)

Returns a new handler that decodes the URL and query parameters into the specified charset, assuming it has not already been done by the connector.

public static NameVirtualHostHandler

Returns:

A new virtual host handler
virtualHost
()

Creates a new virtual host handler

public static NameVirtualHostHandler

Returns:

A new virtual host handler
virtualHost
(final HttpHandler defaultHandler)

Creates a new virtual host handler using the provided default handler

public static NameVirtualHostHandler

Returns:

A new virtual host handler
virtualHost
(final HttpHandler
The host handler
hostHandler
,
String...
The host names
hostnames
)

Creates a new virtual host handler that uses the provided handler as the root handler for the given hostnames.

public static NameVirtualHostHandler

Returns:

A new virtual host handler
virtualHost
(final HttpHandler
The default handler
defaultHandler
,
final HttpHandler
The host handler
hostHandler
,
String...
The host names
hostnames
)

Creates a new virtual host handler that uses the provided handler as the root handler for the given hostnames.

public static WebSocketProtocolHandshakeHandler

Returns:

The web socket handler
websocket
(final WebSocketConnectionCallback
The web socket session handler
sessionHandler
)

public static WebSocketProtocolHandshakeHandler

Returns:

The web socket handler
websocket
(final WebSocketConnectionCallback
The web socket session handler
sessionHandler
,
final HttpHandler
The handler to invoke if the web socket connection fails
next
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Handlersback to summary
private Handlers()

Method Detail

aclback to summary
public static final AccessControlListHandler acl(final HttpHandler next, boolean defaultAllow, ExchangeAttribute attribute)

Returns a new handler that can allow or deny access to a resource based an at attribute of the exchange

Parameters
next:HttpHandler

The next handler in the chain

defaultAllow:boolean

Determine if a non-matching user agent will be allowed by default

Returns:AccessControlListHandler

A new user agent access control handler

dateback to summary
public static DateHandler date(final HttpHandler next)

Deprecated

Returns a new HTTP handler that sets the Date: header. This is no longer necessary, as it is handled by the connectors directly.

Parameters
next:HttpHandler

The next handler in the chain

Returns:DateHandler

A new date handler

Annotations
@Deprecated
disableCacheback to summary
public static HttpHandler disableCache(final HttpHandler next)

Handler that sets the headers that disable caching of the response

Parameters
next:HttpHandler

The next handler

Returns:HttpHandler

The handler

exceptionHandlerback to summary
public static ExceptionHandler exceptionHandler(final HttpHandler next)

Returns a handler that maps exceptions to additional handlers

Parameters
next:HttpHandler

The next handler

Returns:ExceptionHandler

The exception handler

gracefulShutdownback to summary
public static GracefulShutdownHandler gracefulShutdown(HttpHandler next)

Returns a new handler that can be used to wait for all requests to finish before shutting down the server gracefully.

Parameters
next:HttpHandler

The next http handler

Returns:GracefulShutdownHandler

The graceful shutdown handler

handlerNotNullback to summary
public static void handlerNotNull(final HttpHandler handler)
headerback to summary
public static SetHeaderHandler header(final HttpHandler next, final String headerName, final String headerValue)

Returns a handler that sets a response header

Parameters
next:HttpHandler

The next handler in the chain

headerName:String

The name of the header

headerValue:String

The header value

Returns:SetHeaderHandler

A new set header handler

headerback to summary
public static SetHeaderHandler header(final HttpHandler next, final String headerName, final ExchangeAttribute headerValue)

Returns a handler that sets a response header

Parameters
next:HttpHandler

The next handler in the chain

headerName:String

The name of the header

headerValue:ExchangeAttribute

The header value

Returns:SetHeaderHandler

A new set header handler

httpContinueAcceptingback to summary
public static final HttpContinueAcceptingHandler httpContinueAccepting(final HttpHandler next, final Predicate accept)

Returns a handler that sends back a HTTP 100 continue response if the given predicate resolves to true. This handler differs from the one returned by httpContinueRead(io.undertow.server.HttpHandler) in that it will eagerly send the response, and not wait for the first read attempt.

Parameters
next:HttpHandler

The next handler

accept:Predicate

The predicate used to determine if the request should be accepted

Returns:HttpContinueAcceptingHandler

The accepting handler

httpContinueAcceptingback to summary
public static final HttpContinueAcceptingHandler httpContinueAccepting(final HttpHandler next)

Returns a handler that sends back a HTTP 100 continue response to all requests. This handler differs from the one returned by httpContinueRead(io.undertow.server.HttpHandler) in that it will eagerly send the response, and not wait for the first read attempt.

Parameters
next:HttpHandler

The next handler

Returns:HttpContinueAcceptingHandler

The accepting handler

httpContinueReadback to summary
public static final HttpContinueReadHandler httpContinueRead(final HttpHandler next)

A handler that automatically handles HTTP 100-continue responses, by sending a continue response when the first attempt is made to read from the request channel.

Parameters
next:HttpHandler

The next handler in the chain

Returns:HttpContinueReadHandler

A new continue handler

ipAccessControlback to summary
public static final IPAddressAccessControlHandler ipAccessControl(final HttpHandler next, boolean defaultAllow)

Returns a new handler that can allow or deny access to a resource based on IP address

Parameters
next:HttpHandler

The next handler in the chain

defaultAllow:boolean

Determine if a non-matching address will be allowed by default

Returns:IPAddressAccessControlHandler

A new IP access control handler

jvmRouteback to summary
public static JvmRouteHandler jvmRoute(final String sessionCookieName, final String jvmRoute, HttpHandler next)

Handler that appends the JVM route to the session cookie

Parameters
sessionCookieName:String

The session cookie name

jvmRoute:String

The JVM route to append

next:HttpHandler

The next handler

Returns:JvmRouteHandler

The handler

learningPushHandlerback to summary
public static LearningPushHandler learningPushHandler(int maxEntries, int maxAge, HttpHandler next)

Creates a handler that automatically learns which resources to push based on the referer header

Parameters
maxEntries:int

The maximum number of entries to store

maxAge:int

The maximum age of the entries

next:HttpHandler

The next handler

Returns:LearningPushHandler

A caching push handler

learningPushHandlerback to summary
public static LearningPushHandler learningPushHandler(int maxEntries, HttpHandler next)

Creates a handler that automatically learns which resources to push based on the referer header

Parameters
maxEntries:int

The maximum number of entries to store

next:HttpHandler

The next handler

Returns:LearningPushHandler

A caching push handler

pathback to summary
public static PathHandler path(final HttpHandler defaultHandler)

Creates a new path handler, with the default handler specified

Parameters
defaultHandler:HttpHandler

The default handler

Returns:PathHandler

A new path handler

pathback to summary
public static PathHandler path()

Creates a new path handler

Returns:PathHandler

A new path handler

pathTemplateback to summary
public static PathTemplateHandler pathTemplate()
Returns:PathTemplateHandler

a new path template handler

pathTemplateback to summary
public static PathTemplateHandler pathTemplate(boolean rewriteQueryParams)
Parameters
rewriteQueryParams:boolean

If the query params should be rewritten

Returns:PathTemplateHandler

The path template handler

predicateback to summary
public static PredicateHandler predicate(final Predicate predicate, final HttpHandler trueHandler, final HttpHandler falseHandler)

Returns a new predicate handler, that will delegate to one of the two provided handlers based on the value of the provided predicate.

Parameters
predicate:Predicate

The predicate

trueHandler:HttpHandler

The handler that will be executed if the predicate is true

falseHandler:HttpHandler

The handler that will be exected if the predicate is false

Returns:PredicateHandler

A new predicate handler

See Also
Predicate, io.undertow.predicate.Predicates
predicateContextback to summary
public static HttpHandler predicateContext(HttpHandler next)
Parameters
next:HttpHandler

The next handler

Returns:HttpHandler

a handler that sets up a new predicate context

predicatesback to summary
public static PredicatesHandler predicates(final List<PredicatedHandler> handlers, HttpHandler next)
proxyHandlerback to summary
public static ProxyHandler proxyHandler(ProxyClient proxyClient, int maxRequestTime, HttpHandler next)

Returns a handler that can act as a load balancing reverse proxy.

Parameters
proxyClient:ProxyClient

The proxy client to use to connect to the remote server

maxRequestTime:int

The maximum amount of time a request can be in progress before it is forcibly closed

next:HttpHandler

The next handler to invoke if the proxy client does not know how to proxy the request

Returns:ProxyHandler

The proxy handler

proxyHandlerback to summary
public static ProxyHandler proxyHandler(ProxyClient proxyClient, HttpHandler next)

Returns a handler that can act as a load balancing reverse proxy.

Parameters
proxyClient:ProxyClient

The proxy client to use to connect to the remote server

next:HttpHandler

The next handler to invoke if the proxy client does not know how to proxy the request

Returns:ProxyHandler

The proxy handler

proxyHandlerback to summary
public static ProxyHandler proxyHandler(ProxyClient proxyClient)

Returns a handler that can act as a load balancing reverse proxy.

Parameters
proxyClient:ProxyClient

The proxy client to use to connect to the remote server

Returns:ProxyHandler

The proxy handler

proxyPeerAddressback to summary
public static ProxyPeerAddressHandler proxyPeerAddress(HttpHandler next)

Returns a new handler that sets the peer address based on the X-Forwarded-For and X-Forwarded-Proto header

Parameters
next:HttpHandler

The next http handler

Returns:ProxyPeerAddressHandler

The handler

redirectback to summary
public static RedirectHandler redirect(final String location)

Returns a new redirect handler

Parameters
location:String

The redirect location

Returns:RedirectHandler

A new redirect handler

requestDumpback to summary
public static HttpHandler requestDump(final HttpHandler next)

Returns a handler that dumps requests to the log for debugging purposes.

Parameters
next:HttpHandler

The next handler

Returns:HttpHandler

The request dumping handler

requestLimitingHandlerback to summary
public static RequestLimitingHandler requestLimitingHandler(final int maxRequest, final int queueSize, HttpHandler next)

Returns a handler that limits the maximum number of requests that can run at a time.

Parameters
maxRequest:int

The maximum number of requests

queueSize:int

The maximum number of queued requests

next:HttpHandler

The next handler

Returns:RequestLimitingHandler

The handler

requestLimitingHandlerback to summary
public static RequestLimitingHandler requestLimitingHandler(final RequestLimit requestLimit, HttpHandler next)

Returns a handler that limits the maximum number of requests that can run at a time.

Parameters
requestLimit:RequestLimit

The request limit object that can be shared between handlers, to apply the same limits across multiple handlers

next:HttpHandler

The next handler

Returns:RequestLimitingHandler

The handler

resourceback to summary
public static ResourceHandler resource(final ResourceManager resourceManager)

Return a new resource handler

Parameters
resourceManager:ResourceManager

The resource manager to use

Returns:ResourceHandler

A new resource handler

responseRateLimitingHandlerback to summary
public static ResponseRateLimitingHandler 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

rewriteback to summary
public static HttpHandler rewrite(final String condition, final String target, final ClassLoader classLoader, final HttpHandler next)

Creates the set of handlers that are required to perform a simple rewrite.

Parameters
condition:String

The rewrite condition

target:String

The rewrite target if the condition matches

next:HttpHandler

The next handler

routingback to summary
public static RoutingHandler routing(boolean rewriteQueryParams)
Parameters
rewriteQueryParams:boolean

If the query params should be rewritten

Returns:RoutingHandler

The routing handler

routingback to summary
public static RoutingHandler routing()
Returns:RoutingHandler

a new routing handler

serverSentEventsback to summary
public static ServerSentEventHandler serverSentEvents(ServerSentEventConnectionCallback callback)

A handler for server sent events

Parameters
callback:ServerSentEventConnectionCallback

The server sent events callback

Returns:ServerSentEventHandler

A new server sent events handler

serverSentEventsback to summary
public static ServerSentEventHandler serverSentEvents()

A handler for server sent events

Returns:ServerSentEventHandler

A new server sent events handler

setAttributeback to summary
public static SetAttributeHandler setAttribute(final HttpHandler next, final String attribute, final String value, final ClassLoader classLoader)

Returns an attribute setting handler that can be used to set an arbitrary attribute on the exchange. This includes functions such as adding and removing headers etc.

Parameters
next:HttpHandler

The next handler

attribute:String

The attribute to set, specified as a string presentation of an io.undertow.attribute.ExchangeAttribute

value:String

The value to set, specified an a string representation of an io.undertow.attribute.ExchangeAttribute

classLoader:ClassLoader

The class loader to use to parser the exchange attributes

Returns:SetAttributeHandler

The handler

setErrorHandlerback to summary
public static SetErrorHandler setErrorHandler(int responseCode, HttpHandler next)

A handler that sets response code but continues the exchange so the servlet's error page can be returned.

Parameters
responseCode:int

The response code to set

next:HttpHandler

The next handler

Returns:SetErrorHandler

A Set Error handler

traceback to summary
public static HttpTraceHandler trace(final HttpHandler next)

Returns a new HTTP trace handler. This handler will handle HTTP TRACE requests as per the RFC.

Warning

enabling trace requests may leak information, in general it is recommended that these be disabled for security reasons.

Parameters
next:HttpHandler

The next handler in the chain

Returns:HttpTraceHandler

A HTTP trace handler

urlDecodingback to summary
public static final URLDecodingHandler urlDecoding(final HttpHandler next, final String charset)

A handler that will decode the URL, query parameters and to the specified charset.

If you are using this handler you must set the io.undertow.UndertowOptions#DECODE_URL parameter to false.

This is not as efficient as using the parsers built in UTF-8 decoder. Unless you need to decode to something other than UTF-8 you should rely on the parsers decoding instead.

Parameters
next:HttpHandler

The next handler in the chain

charset:String

The charset to decode to

Returns:URLDecodingHandler

a new url decoding handler

urlDecodingHandlerback to summary
public static HttpHandler urlDecodingHandler(final String charset, final HttpHandler next)

Returns a new handler that decodes the URL and query parameters into the specified charset, assuming it has not already been done by the connector. For this handler to take effect the parameter UndertowOptions#DECODE_URL must have been set to false.

Parameters
charset:String

The charset to decode

next:HttpHandler

The next handler

Returns:HttpHandler

A handler that decodes the URL

virtualHostback to summary
public static NameVirtualHostHandler virtualHost()

Creates a new virtual host handler

Returns:NameVirtualHostHandler

A new virtual host handler

virtualHostback to summary
public static NameVirtualHostHandler virtualHost(final HttpHandler defaultHandler)

Creates a new virtual host handler using the provided default handler

Returns:NameVirtualHostHandler

A new virtual host handler

virtualHostback to summary
public static NameVirtualHostHandler virtualHost(final HttpHandler hostHandler, String... hostnames)

Creates a new virtual host handler that uses the provided handler as the root handler for the given hostnames.

Parameters
hostHandler:HttpHandler

The host handler

hostnames:String[]

The host names

Returns:NameVirtualHostHandler

A new virtual host handler

virtualHostback to summary
public static NameVirtualHostHandler virtualHost(final HttpHandler defaultHandler, final HttpHandler hostHandler, String... hostnames)

Creates a new virtual host handler that uses the provided handler as the root handler for the given hostnames.

Parameters
defaultHandler:HttpHandler

The default handler

hostHandler:HttpHandler

The host handler

hostnames:String[]

The host names

Returns:NameVirtualHostHandler

A new virtual host handler

websocketback to summary
public static WebSocketProtocolHandshakeHandler websocket(final WebSocketConnectionCallback sessionHandler)
Parameters
sessionHandler:WebSocketConnectionCallback

The web socket session handler

Returns:WebSocketProtocolHandshakeHandler

The web socket handler

websocketback to summary
public static WebSocketProtocolHandshakeHandler websocket(final WebSocketConnectionCallback sessionHandler, final HttpHandler next)
Parameters
sessionHandler:WebSocketConnectionCallback

The web socket session handler

next:HttpHandler

The handler to invoke if the web socket connection fails

Returns:WebSocketProtocolHandshakeHandler

The web socket handler