io.undertow.server.handlers

## Class ChannelUpgradeHandler

- java.lang.Object
- - io.undertow.server.handlers.ChannelUpgradeHandler

All Implemented Interfaces:
  HttpHandler

    public final class ChannelUpgradeHandler
    extends 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 and Description
`ChannelUpgradeHandler()`

### Method Summary

All Methods Instance Methods Concrete Methods
`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.
`void` `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.
`HttpHandler` `getNonUpgradeHandler()` 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, org.xnio.ChannelListener<? super org.xnio.StreamConnection> openListener)` Remove a protocol from this handler.
`void` `removeProtocol(String productString, HttpUpgradeListener upgradeListener)` Remove a protocol from this handler.
`ChannelUpgradeHandler` `setNonUpgradeHandler(HttpHandler nonUpgradeHandler)` Set the non-upgrade delegate handler.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ChannelUpgradeHandler

    public ChannelUpgradeHandler()

### Method Detail

#### 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 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(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(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(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(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(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(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 Exception

Description copied from interface: `HttpHandler`
Handle the request.

Specified by:
  `handleRequest` in interface `HttpHandler`
Parameters:
  `exchange` - the HTTP request/response exchange
Throws:
  `Exception`