Top Description Inners Fields Constructors Methods
io.undertow.server.protocol.http

public Class AlpnOpenListener

extends Object
implements ChannelListener<StreamConnection>, OpenListener
Class Inheritance
All Implemented Interfaces
io.undertow.server.OpenListener, org.xnio.ChannelListener, java.util.EventListener
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.ArrayList, .Arrays, .Collections, .HashMap, .HashSet, .List, .Map, .Set, java.util.concurrent.CompletableFuture, java.util.function.Function, javax.net.ssl.SSLEngine, org.xnio.ChannelListener, .IoUtils, .OptionMap, .Pool, .StreamConnection, org.xnio.channels.StreamSourceChannel, org.xnio.ssl.SslConnection, io.undertow.UndertowLogger, .UndertowMessages, .UndertowOptions, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, io.undertow.protocols.alpn.ALPNManager, .ALPNProvider, io.undertow.protocols.ssl.SslConduit, .UndertowXnioSsl, io.undertow.server.AggregateConnectorStatistics, .ConnectorStatistics, .DelegateOpenListener, .HttpHandler, .OpenListener, .XnioByteBufferPool

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 and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private volatile boolean
private final ALPNManager
private final ByteBufferPool
private final String
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.

private final Map<String, AlpnOpenListener.ListenerEntry>
private String[]
private volatile boolean
public static final String
REQUIRED_CIPHER

HTTP/2 required cipher.

private static final Set<String>
private volatile HttpHandler
private volatile boolean
private volatile OptionMap

Constructor Summary

AccessConstructor and Description
public
AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions, DelegateOpenListener httpListener)
References Deprecated Pool is deprecated or references (maybe indirectly) at least one deprecated element.

public
AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions)
References Deprecated Pool is deprecated or references (maybe indirectly) at least one deprecated element.

public
AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener)
References Deprecated Pool is deprecated or references (maybe indirectly) at least one deprecated element.

public
AlpnOpenListener(ByteBufferPool bufferPool, OptionMap undertowOptions, DelegateOpenListener httpListener)

public
public
AlpnOpenListener(ByteBufferPool bufferPool, OptionMap undertowOptions)

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

Method Summary

Modifier and TypeMethod and Description
public AlpnOpenListener
addProtocol(String name, DelegateOpenListener listener, int weight)

public void
closeConnections()

Overrides default io.undertow.server.OpenListener.closeConnections.

Close all active connections that were handled by this listener

public static boolean
public ByteBufferPool
public ConnectorStatistics
public HttpHandler
public OptionMap
public void
handleEvent(final StreamConnection
the channel event
channel
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

public void
setRootHandler(HttpHandler
The new root handler
rootHandler
)

Implements io.undertow.server.OpenListener.setRootHandler.

Sets the root handler

public void
setUndertowOptions(OptionMap
The connector options
undertowOptions
)

Implements io.undertow.server.OpenListener.setUndertowOptions.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alpnFailLoggedback to summary
private volatile boolean alpnFailLogged
alpnManagerback to summary
private final ALPNManager alpnManager
bufferPoolback to summary
private final ByteBufferPool bufferPool
fallbackProtocolback to summary
private final String fallbackProtocol
IBM_REQUIRED_CIPHERback to summary
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.

listenersback to summary
private final Map<String, AlpnOpenListener.ListenerEntry> listeners
protocolsback to summary
private String[] protocols
providerLoggedback to summary
private volatile boolean providerLogged
REQUIRED_CIPHERback to summary
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.

REQUIRED_PROTOCOLSback to summary
private static final Set<String> REQUIRED_PROTOCOLS
rootHandlerback to summary
private volatile HttpHandler rootHandler
statisticsEnabledback to summary
private volatile boolean statisticsEnabled
undertowOptionsback to summary
private volatile OptionMap undertowOptions

Constructor Detail

AlpnOpenListenerback to summary
public AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions, DelegateOpenListener httpListener)

References Deprecated

Pool is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

AlpnOpenListenerback to summary
public AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions)

References Deprecated

Pool is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

AlpnOpenListenerback to summary
public AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener)

References Deprecated

Pool is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

AlpnOpenListenerback to summary
public AlpnOpenListener(ByteBufferPool bufferPool, OptionMap undertowOptions, DelegateOpenListener httpListener)
AlpnOpenListenerback to summary
public AlpnOpenListener(ByteBufferPool bufferPool)
AlpnOpenListenerback to summary
public AlpnOpenListener(ByteBufferPool bufferPool, OptionMap undertowOptions)
AlpnOpenListenerback to summary
public AlpnOpenListener(ByteBufferPool bufferPool, OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener)

Method Detail

addProtocolback to summary
public AlpnOpenListener addProtocol(String name, DelegateOpenListener listener, int weight)
closeConnectionsback to summary
public void closeConnections()

Overrides default io.undertow.server.OpenListener.closeConnections.

Doc from io.undertow.server.OpenListener.closeConnections.

Close all active connections that were handled by this listener

Annotations
@Override
engineSupportsHTTP2back to summary
public static boolean engineSupportsHTTP2(SSLEngine engine)
getBufferPoolback to summary
public ByteBufferPool getBufferPool()

Implements io.undertow.server.OpenListener.getBufferPool.

Returns:ByteBufferPool

Doc from io.undertow.server.OpenListener.getBufferPool.

The buffer pool in use by this connector

Annotations
@Override
getConnectorStatisticsback to summary
public ConnectorStatistics getConnectorStatistics()

Implements io.undertow.server.OpenListener.getConnectorStatistics.

Returns:ConnectorStatistics

Doc from io.undertow.server.OpenListener.getConnectorStatistics.

The connector statistics, or null if statistics gathering is disabled.

Annotations
@Override
getRootHandlerback to summary
public HttpHandler getRootHandler()

Implements io.undertow.server.OpenListener.getRootHandler.

Returns:HttpHandler

Doc from io.undertow.server.OpenListener.getRootHandler.

The first handler that will be executed by requests on the connector

Annotations
@Override
getUndertowOptionsback to summary
public OptionMap getUndertowOptions()

Implements io.undertow.server.OpenListener.getUndertowOptions.

Returns:OptionMap

Doc from io.undertow.server.OpenListener.getUndertowOptions.

The connector options

Annotations
@Override
handleEventback to summary
public void handleEvent(final StreamConnection channel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
channel:StreamConnection

the channel event

setRootHandlerback to summary
public void setRootHandler(HttpHandler rootHandler)

Implements io.undertow.server.OpenListener.setRootHandler.

Doc from io.undertow.server.OpenListener.setRootHandler.

Sets the root handler

Parameters
rootHandler:HttpHandler

The new root handler

Annotations
@Override
setUndertowOptionsback to summary
public void setUndertowOptions(OptionMap undertowOptions)

Implements io.undertow.server.OpenListener.setUndertowOptions.

Parameters
undertowOptions:OptionMap

Doc from io.undertow.server.OpenListener.setUndertowOptions.

The connector options

Annotations
@Override
io.undertow.server.protocol.http back to summary

private Class AlpnOpenListener.AlpnConnectionListener

extends Object
implements ChannelListener<StreamSourceChannel>
Class Inheritance
  • java.lang.Object
  • io.undertow.server.protocol.http.AlpnOpenListener.AlpnConnectionListener
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener

Field Summary

Modifier and TypeField and Description
private final StreamConnection
private final CompletableFuture<AlpnOpenListener.SelectedAlpn>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
handleEvent(StreamSourceChannel
the channel event
source
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

channelback to summary
private final StreamConnection channel
selectedAlpnback to summary
private final CompletableFuture<AlpnOpenListener.SelectedAlpn> selectedAlpn

Constructor Detail

AlpnConnectionListenerback to summary
private AlpnConnectionListener(StreamConnection channel, CompletableFuture<AlpnOpenListener.SelectedAlpn> selectedAlpn)

Method Detail

handleEventback to summary
public void handleEvent(StreamSourceChannel source)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
source:StreamSourceChannel

the channel event

Annotations
@Override
io.undertow.server.protocol.http back to summary

private Class AlpnOpenListener.ListenerEntry

extends Object
implements Comparable<AlpnOpenListener.ListenerEntry>
Class Inheritance
  • java.lang.Object
  • io.undertow.server.protocol.http.AlpnOpenListener.ListenerEntry
All Implemented Interfaces
java.lang.Comparable

Field Summary

Modifier and TypeField and Description
pack-priv final DelegateOpenListener
pack-priv final String
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
ListenerEntry(DelegateOpenListener listener, int weight, String protocol)

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(AlpnOpenListener.ListenerEntry
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

listenerback to summary
pack-priv final DelegateOpenListener listener
protocolback to summary
pack-priv final String protocol
weightback to summary
pack-priv final int weight

Constructor Detail

ListenerEntryback to summary
pack-priv ListenerEntry(DelegateOpenListener listener, int weight, String protocol)

Method Detail

compareToback to summary
public int compareTo(AlpnOpenListener.ListenerEntry o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:AlpnOpenListener.ListenerEntry

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
io.undertow.server.protocol.http back to summary

pack-priv final Class AlpnOpenListener.SelectedAlpn

extends Object
Class Inheritance
  • java.lang.Object
  • io.undertow.server.protocol.http.AlpnOpenListener.SelectedAlpn

Field Summary

Modifier and TypeField and Description
pack-priv final SSLEngine
pack-priv final ALPNProvider

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

engineback to summary
pack-priv final SSLEngine engine
providerback to summary
pack-priv final ALPNProvider provider

Constructor Detail

SelectedAlpnback to summary
pack-priv SelectedAlpn(SSLEngine engine, ALPNProvider provider)
io.undertow.server.protocol.http back to summary

pack-priv final Class AlpnOpenListener.SSLConduitUpdater

extends Object
implements Function<SSLEngine, SSLEngine>
Class Inheritance
  • java.lang.Object
  • io.undertow.server.protocol.http.AlpnOpenListener.SSLConduitUpdater
All Implemented Interfaces
java.util.function.Function

Field Summary

Modifier and TypeField and Description
pack-priv final SslConduit
pack-priv final Function<SSLEngine, SSLEngine>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public SSLEngine
apply(SSLEngine
the function argument
engine
)

Implements java.util.function.Function.apply.

Applies this function to the given argument.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conduitback to summary
pack-priv final SslConduit conduit
underlyingback to summary
pack-priv final Function<SSLEngine, SSLEngine> underlying

Constructor Detail

SSLConduitUpdaterback to summary
pack-priv SSLConduitUpdater(SslConduit conduit, Function<SSLEngine, SSLEngine> underlying)

Method Detail

applyback to summary
public SSLEngine apply(SSLEngine engine)

Implements java.util.function.Function.apply.

Doc from java.util.function.Function.apply.

Applies this function to the given argument.

Parameters
engine:SSLEngine

the function argument

Returns:SSLEngine

the function result

Annotations
@Override