Package io.undertow.server.handlers
Class ChannelUpgradeHandler
java.lang.Object
io.undertow.server.handlers.ChannelUpgradeHandler
- All Implemented Interfaces:
HttpHandler
An HTTP request handler which upgrades the HTTP request and hands it off as a socket to any XNIO consumer.
- Author:
- David M. Lloyd, Stuart Douglas
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProtocol
(String productString, HttpUpgradeListener openListener) Add a protocol to this handler.void
addProtocol
(String productString, HttpUpgradeListener openListener, HttpUpgradeHandshake handshake) Add a protocol to this handler.void
addProtocol
(String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener) Add a protocol to this handler.void
addProtocol
(String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener, HttpUpgradeHandshake handshake) Add a protocol to this handler.Get the non-upgrade delegate handler.void
handleRequest
(HttpServerExchange exchange) Handle the request.void
removeProtocol
(String productString) Remove a protocol from this handler.void
removeProtocol
(String productString, HttpUpgradeListener upgradeListener) Remove a protocol from this handler.void
removeProtocol
(String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener) Remove a protocol from this handler.setNonUpgradeHandler
(HttpHandler nonUpgradeHandler) Set the non-upgrade delegate handler.
-
Constructor Details
-
ChannelUpgradeHandler
public ChannelUpgradeHandler()
-
-
Method Details
-
addProtocol
public void addProtocol(String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener, HttpUpgradeHandshake handshake) Add a protocol to this handler.- Parameters:
productString
- the product string to matchopenListener
- the open listener to callhandshake
- a handshake implementation that can be used to verify the client request and modify the response
-
addProtocol
public void addProtocol(String productString, HttpUpgradeListener openListener, HttpUpgradeHandshake handshake) Add a protocol to this handler.- Parameters:
productString
- the product string to matchopenListener
- the open listener to callhandshake
- a handshake implementation that can be used to verify the client request and modify the response
-
addProtocol
public void addProtocol(String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener) Add a protocol to this handler.- Parameters:
productString
- the product string to matchopenListener
- the open listener to call
-
addProtocol
Add a protocol to this handler.- Parameters:
productString
- the product string to matchopenListener
- the open listener to call
-
removeProtocol
Remove a protocol from this handler. This will remove all upgrade handlers that match the product string- Parameters:
productString
- the product string to match
-
removeProtocol
public void removeProtocol(String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener) Remove a protocol from this handler.- Parameters:
productString
- the product string to matchopenListener
- The open listener
-
removeProtocol
Remove a protocol from this handler.- Parameters:
productString
- the product string to matchupgradeListener
- The upgrade listener
-
getNonUpgradeHandler
Get the non-upgrade delegate handler.- Returns:
- the non-upgrade delegate handler
-
setNonUpgradeHandler
Set the non-upgrade delegate handler.- Parameters:
nonUpgradeHandler
- the non-upgrade delegate handler
-
handleRequest
Description copied from interface:HttpHandler
Handle the request.- Specified by:
handleRequest
in interfaceHttpHandler
- Parameters:
exchange
- the HTTP request/response exchange- Throws:
Exception
-