Class 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 Detail

      • ChannelUpgradeHandler

        public ChannelUpgradeHandler()
    • 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 match
        openListener - the open listener to call
        handshake - 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 match
        openListener - the open listener to call
        handshake - 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 match
        openListener - 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 match
        openListener - 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 match
        openListener - 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 match
        upgradeListener - 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 interface HttpHandler
        Parameters:
        exchange - the HTTP request/response exchange
        Throws:
        java.lang.Exception