io.undertow.server.protocol.http

## Class AlpnOpenListener

- java.lang.Object
- - io.undertow.server.protocol.http.AlpnOpenListener

All Implemented Interfaces:
  OpenListener, EventListener, org.xnio.ChannelListener<org.xnio.StreamConnection>

    public class AlpnOpenListener
    extends Object
    implements org.xnio.ChannelListener<org.xnio.StreamConnection>, OpenListener

Open listener adaptor for ALPN connections

Not a proper open listener as such, but more a mechanism for selecting between them.

Author:
  Stuart Douglas

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.xnio.ChannelListener

`org.xnio.ChannelListener.Setter<T extends Channel>, org.xnio.ChannelListener.SimpleSetter<T extends Channel>`

### Field Summary

Fields
`static String` `IBM_REQUIRED_CIPHER` Names of ciphers in IBM JVM are prefixed with `SSL` instead of `TLS`, see e.g.: https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q113210_.htm.
`static String` `REQUIRED_CIPHER` HTTP/2 required cipher.

### Constructor Summary

Constructors
Constructor and Description
`AlpnOpenListener(ByteBufferPool bufferPool)`
`AlpnOpenListener(ByteBufferPool bufferPool, org.xnio.OptionMap undertowOptions)`
`AlpnOpenListener(ByteBufferPool bufferPool, org.xnio.OptionMap undertowOptions, DelegateOpenListener httpListener)`
`AlpnOpenListener(ByteBufferPool bufferPool, org.xnio.OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener)`
`AlpnOpenListener(org.xnio.Pool<ByteBuffer> bufferPool, org.xnio.OptionMap undertowOptions)`
`AlpnOpenListener(org.xnio.Pool<ByteBuffer> bufferPool, org.xnio.OptionMap undertowOptions, DelegateOpenListener httpListener)`
`AlpnOpenListener(org.xnio.Pool<ByteBuffer> bufferPool, org.xnio.OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`AlpnOpenListener` `addProtocol(String name, DelegateOpenListener listener, int weight)`
`void` `closeConnections()` Close all active connections that were handled by this listener
`static boolean` `engineSupportsHTTP2(SSLEngine engine)`
`ByteBufferPool` `getBufferPool()`
`ConnectorStatistics` `getConnectorStatistics()`
`HttpHandler` `getRootHandler()`
`org.xnio.OptionMap` `getUndertowOptions()`
`void` `handleEvent(org.xnio.StreamConnection channel)`
`void` `setRootHandler(HttpHandler rootHandler)` Sets the root handler
`void` `setUndertowOptions(org.xnio.OptionMap undertowOptions)`

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

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

### Field Detail

#### REQUIRED_CIPHER

    public static final String REQUIRED_CIPHER

HTTP/2 required cipher. Not strictly part of ALPN but it can live here for now till we have a better solution.

See Also:
  Constant Field Values

#### IBM_REQUIRED_CIPHER

    public static final String IBM_REQUIRED_CIPHER

Names of ciphers in IBM JVM are prefixed with `SSL` instead of `TLS`, see e.g.: https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q113210_.htm. Thus let's have IBM alternative for the REQUIRED_CIPHER variable too.

See Also:
  Constant Field Values

### Constructor Detail

#### AlpnOpenListener

    public AlpnOpenListener(org.xnio.Pool<ByteBuffer> bufferPool,
                            org.xnio.OptionMap undertowOptions,
                            DelegateOpenListener httpListener)

#### AlpnOpenListener

    public AlpnOpenListener(org.xnio.Pool<ByteBuffer> bufferPool,
                            org.xnio.OptionMap undertowOptions)

#### AlpnOpenListener

    public AlpnOpenListener(org.xnio.Pool<ByteBuffer> bufferPool,
                            org.xnio.OptionMap undertowOptions,
                            String fallbackProtocol,
                            DelegateOpenListener fallbackListener)

#### AlpnOpenListener

    public AlpnOpenListener(ByteBufferPool bufferPool,
                            org.xnio.OptionMap undertowOptions,
                            DelegateOpenListener httpListener)

#### AlpnOpenListener

    public AlpnOpenListener(ByteBufferPool bufferPool)

#### AlpnOpenListener

    public AlpnOpenListener(ByteBufferPool bufferPool,
                            org.xnio.OptionMap undertowOptions)

#### AlpnOpenListener

    public AlpnOpenListener(ByteBufferPool bufferPool,
                            org.xnio.OptionMap undertowOptions,
                            String fallbackProtocol,
                            DelegateOpenListener fallbackListener)

### Method Detail

#### getRootHandler

    public HttpHandler getRootHandler()

Specified by:
  `getRootHandler` in interface `OpenListener`
Returns:
  The first handler that will be executed by requests on the connector

#### setRootHandler

    public void setRootHandler(HttpHandler rootHandler)

Description copied from interface: `OpenListener`
Sets the root handler

Specified by:
  `setRootHandler` in interface `OpenListener`
Parameters:
  `rootHandler` - The new root handler

#### getUndertowOptions

    public org.xnio.OptionMap getUndertowOptions()

Specified by:
  `getUndertowOptions` in interface `OpenListener`
Returns:
  The connector options

#### setUndertowOptions

    public void setUndertowOptions(org.xnio.OptionMap undertowOptions)

Specified by:
  `setUndertowOptions` in interface `OpenListener`
Parameters:
  `undertowOptions` - The connector options

#### getBufferPool

    public ByteBufferPool getBufferPool()

Specified by:
  `getBufferPool` in interface `OpenListener`
Returns:
  The buffer pool in use by this connector

#### getConnectorStatistics

    public ConnectorStatistics getConnectorStatistics()

Specified by:
  `getConnectorStatistics` in interface `OpenListener`
Returns:
  The connector statistics, or null if statistics gathering is disabled.

#### closeConnections

    public void closeConnections()

Description copied from interface: `OpenListener`
Close all active connections that were handled by this listener

Specified by:
  `closeConnections` in interface `OpenListener`

#### addProtocol

    public AlpnOpenListener addProtocol(String name,
                                        DelegateOpenListener listener,
                                        int weight)

#### handleEvent

    public void handleEvent(org.xnio.StreamConnection channel)

Specified by:
  `handleEvent` in interface `org.xnio.ChannelListener<org.xnio.StreamConnection>`

#### engineSupportsHTTP2

    public static boolean engineSupportsHTTP2(SSLEngine engine)