Package io.undertow.server.handlers
Class ChannelUpgradeHandler
- java.lang.Object
-
- io.undertow.server.handlers.ChannelUpgradeHandler
-
- All Implemented Interfaces:
HttpHandler
public final class ChannelUpgradeHandler extends java.lang.Object implements 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 Constructor Description ChannelUpgradeHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProtocol(java.lang.String productString, HttpUpgradeListener openListener)
Add a protocol to this handler.void
addProtocol(java.lang.String productString, HttpUpgradeListener openListener, HttpUpgradeHandshake handshake)
Add a protocol to this handler.void
addProtocol(java.lang.String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener)
Add a protocol to this handler.void
addProtocol(java.lang.String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener, HttpUpgradeHandshake handshake)
Add a protocol to this handler.HttpHandler
getNonUpgradeHandler()
Get the non-upgrade delegate handler.void
handleRequest(HttpServerExchange exchange)
Handle the request.void
removeProtocol(java.lang.String productString)
Remove a protocol from this handler.void
removeProtocol(java.lang.String productString, HttpUpgradeListener upgradeListener)
Remove a protocol from this handler.void
removeProtocol(java.lang.String productString, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener)
Remove a protocol from this handler.ChannelUpgradeHandler
setNonUpgradeHandler(HttpHandler nonUpgradeHandler)
Set the non-upgrade delegate handler.
-
-
-
Method Detail
-
addProtocol
public void addProtocol(java.lang.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(java.lang.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(java.lang.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
public void addProtocol(java.lang.String productString, HttpUpgradeListener openListener)
Add a protocol to this handler.- Parameters:
productString
- the product string to matchopenListener
- the open listener to call
-
removeProtocol
public void removeProtocol(java.lang.String productString)
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(java.lang.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
public void removeProtocol(java.lang.String productString, HttpUpgradeListener upgradeListener)
Remove a protocol from this handler.- Parameters:
productString
- the product string to matchupgradeListener
- The upgrade listener
-
getNonUpgradeHandler
public HttpHandler getNonUpgradeHandler()
Get the non-upgrade delegate handler.- Returns:
- the non-upgrade delegate handler
-
setNonUpgradeHandler
public ChannelUpgradeHandler setNonUpgradeHandler(HttpHandler nonUpgradeHandler)
Set the non-upgrade delegate handler.- Parameters:
nonUpgradeHandler
- the non-upgrade delegate handler
-
handleRequest
public void handleRequest(HttpServerExchange exchange) throws java.lang.Exception
Description copied from interface:HttpHandler
Handle the request.- Specified by:
handleRequest
in interfaceHttpHandler
- Parameters:
exchange
- the HTTP request/response exchange- Throws:
java.lang.Exception
-
-