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

public final Class ChannelUpgradeHandler

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

An HTTP request handler which upgrades the HTTP request and hands it off as a socket to any XNIO consumer.
Authors
David M. Lloyd, Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final CopyOnWriteMap<String, List<ChannelUpgradeHandler.Holder>>
private volatile HttpHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addProtocol(String
the product string to match
productString
,
ChannelListener<? super StreamConnection>
the open listener to call
openListener
,
final HttpUpgradeHandshake
a handshake implementation that can be used to verify the client request and modify the response
handshake
)

Add a protocol to this handler.

public synchronized void
addProtocol(String
the product string to match
productString
,
HttpUpgradeListener
the open listener to call
openListener
,
final HttpUpgradeHandshake
a handshake implementation that can be used to verify the client request and modify the response
handshake
)

Add a protocol to this handler.

private synchronized void
addProtocol(String productString, HttpUpgradeListener openListener, final ChannelListener<? super StreamConnection> channelListener, final HttpUpgradeHandshake handshake)

public void
addProtocol(String
the product string to match
productString
,
ChannelListener<? super StreamConnection>
the open listener to call
openListener
)

Add a protocol to this handler.

public void
addProtocol(String
the product string to match
productString
,
HttpUpgradeListener
the open listener to call
openListener
)

Add a protocol to this handler.

public HttpHandler

Returns:

the non-upgrade delegate handler
getNonUpgradeHandler
()

Get the non-upgrade delegate handler.

public void
handleRequest(final HttpServerExchange
the HTTP request/response exchange
exchange
)

Implements io.undertow.server.HttpHandler.handleRequest.

Handle the request.

public synchronized void
removeProtocol(String
the product string to match
productString
)

Remove a protocol from this handler.

public synchronized void
removeProtocol(String
the product string to match
productString
,
ChannelListener<? super StreamConnection>
The open listener
openListener
)

Remove a protocol from this handler.

public synchronized void
removeProtocol(String
the product string to match
productString
,
HttpUpgradeListener
The upgrade listener
upgradeListener
)

Remove a protocol from this handler.

public ChannelUpgradeHandler
setNonUpgradeHandler(final HttpHandler
the non-upgrade delegate handler
nonUpgradeHandler
)

Set the non-upgrade delegate handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlersback to summary
private final CopyOnWriteMap<String, List<ChannelUpgradeHandler.Holder>> handlers
nonUpgradeHandlerback to summary
private volatile HttpHandler nonUpgradeHandler

Constructor Detail

ChannelUpgradeHandlerback to summary
public ChannelUpgradeHandler()

Method Detail

addProtocolback to summary
public synchronized void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener, final HttpUpgradeHandshake handshake)

Add a protocol to this handler.

Parameters
productString:String

the product string to match

openListener:ChannelListener<? super StreamConnection>

the open listener to call

handshake:HttpUpgradeHandshake

a handshake implementation that can be used to verify the client request and modify the response

addProtocolback to summary
public synchronized void addProtocol(String productString, HttpUpgradeListener openListener, final HttpUpgradeHandshake handshake)

Add a protocol to this handler.

Parameters
productString:String

the product string to match

openListener:HttpUpgradeListener

the open listener to call

handshake:HttpUpgradeHandshake

a handshake implementation that can be used to verify the client request and modify the response

addProtocolback to summary
private synchronized void addProtocol(String productString, HttpUpgradeListener openListener, final ChannelListener<? super StreamConnection> channelListener, final HttpUpgradeHandshake handshake)
addProtocolback to summary
public void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener)

Add a protocol to this handler.

Parameters
productString:String

the product string to match

openListener:ChannelListener<? super StreamConnection>

the open listener to call

addProtocolback to summary
public void addProtocol(String productString, HttpUpgradeListener openListener)

Add a protocol to this handler.

Parameters
productString:String

the product string to match

openListener:HttpUpgradeListener

the open listener to call

getNonUpgradeHandlerback to summary
public HttpHandler getNonUpgradeHandler()

Get the non-upgrade delegate handler.

Returns:HttpHandler

the non-upgrade delegate handler

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

removeProtocolback to summary
public synchronized void removeProtocol(String productString)

Remove a protocol from this handler. This will remove all upgrade handlers that match the product string

Parameters
productString:String

the product string to match

removeProtocolback to summary
public synchronized void removeProtocol(String productString, ChannelListener<? super StreamConnection> openListener)

Remove a protocol from this handler.

Parameters
productString:String

the product string to match

openListener:ChannelListener<? super StreamConnection>

The open listener

removeProtocolback to summary
public synchronized void removeProtocol(String productString, HttpUpgradeListener upgradeListener)

Remove a protocol from this handler.

Parameters
productString:String

the product string to match

upgradeListener:HttpUpgradeListener

The upgrade listener

setNonUpgradeHandlerback to summary
public ChannelUpgradeHandler setNonUpgradeHandler(final HttpHandler nonUpgradeHandler)

Set the non-upgrade delegate handler.

Parameters
nonUpgradeHandler:HttpHandler

the non-upgrade delegate handler

io.undertow.server.handlers back to summary

private final Class ChannelUpgradeHandler.Holder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final ChannelListener<? super StreamConnection>
pack-priv final HttpUpgradeHandshake
pack-priv final HttpUpgradeListener

Constructor Summary

AccessConstructor and Description
private
Holder(final HttpUpgradeListener listener, final HttpUpgradeHandshake handshake, ChannelListener<? super StreamConnection> channelListener)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

channelListenerback to summary
pack-priv final ChannelListener<? super StreamConnection> channelListener
handshakeback to summary
pack-priv final HttpUpgradeHandshake handshake
listenerback to summary
pack-priv final HttpUpgradeListener listener

Constructor Detail

Holderback to summary
private Holder(final HttpUpgradeListener listener, final HttpUpgradeHandshake handshake, ChannelListener<? super StreamConnection> channelListener)