Top Methods
org.apache.coyote

public Interface UpgradeProtocol

Known Direct Implementers
org.apache.coyote.http2.Http2Protocol
Imports
org.apache.coyote.http11.AbstractHttp11Protocol, org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler, org.apache.tomcat.util.net.SocketWrapperBase

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the request is accepted, otherwise false
accept
(Request
The request that included an upgrade header for this protocol
request
)

Allows the implementation to examine the request and accept or reject it based on what it finds.

public byte[]

Returns:

The byte sequence as listed in the IANA registry for this protocol or null if upgrade via ALPN is not supported.
getAlpnIdentifier
()

public String

Returns:

The name of the protocol as listed in the IANA registry if and only if getAlpnIdentifier() returns the UTF-8 encoding of this name. If getAlpnIdentifier() returns some other byte sequence, then this method returns the empty string. If upgrade via ALPN is not supported then null is returned.
getAlpnName
()

public String

Returns:

The name that clients will use to request an upgrade to this protocol via an HTTP/1.1 upgrade request or null if upgrade via an HTTP/1.1 upgrade request is not supported.
getHttpUpgradeName
(boolean
Is this for a connector that is configured to support TLS. Some protocols (e.g. HTTP/2) only support HTTP upgrade over non-secure connections.
isSSLEnabled
)

public InternalHttpUpgradeHandler

Returns:

An instance of the HTTP upgrade handler for this protocol
getInternalUpgradeHandler
(SocketWrapperBase<?>
The socket
socketWrapper
,
Adapter
The Adapter to use to configure the new upgrade handler
adapter
,
Request
A copy (may be incomplete) of the request that triggered the upgrade
request
)

public Processor

Returns:

A processor instance for processing a connection using this protocol.
getProcessor
(SocketWrapperBase<?>
The socketWrapper for the connection that requires a processor
socketWrapper
,
Adapter
The Adapter instance that provides access to the standard Engine/Host/Context/Wrapper processing chain
adapter
)

public default void
setHttp11Protocol(AbstractHttp11Protocol<?>
The HTTP/1.1 protocol implementation that will initially handle any connections passed to this UpgradeProtocol via the HTTP upgrade mechanism
protocol
)

Configure the HTTP/1.1 protocol that this UpgradeProcotol is nested under.

Method Detail

acceptback to summary
public boolean accept(Request request)

Allows the implementation to examine the request and accept or reject it based on what it finds.

Parameters
request:Request

The request that included an upgrade header for this protocol

Returns:boolean

true if the request is accepted, otherwise false

getAlpnIdentifierback to summary
public byte[] getAlpnIdentifier()
Returns:byte[]

The byte sequence as listed in the IANA registry for this protocol or null if upgrade via ALPN is not supported.

getAlpnNameback to summary
public String getAlpnName()
Returns:String

The name of the protocol as listed in the IANA registry if and only if getAlpnIdentifier() returns the UTF-8 encoding of this name. If getAlpnIdentifier() returns some other byte sequence, then this method returns the empty string. If upgrade via ALPN is not supported then null is returned.

getHttpUpgradeNameback to summary
public String getHttpUpgradeName(boolean isSSLEnabled)
Parameters
isSSLEnabled:boolean

Is this for a connector that is configured to support TLS. Some protocols (e.g. HTTP/2) only support HTTP upgrade over non-secure connections.

Returns:String

The name that clients will use to request an upgrade to this protocol via an HTTP/1.1 upgrade request or null if upgrade via an HTTP/1.1 upgrade request is not supported.

getInternalUpgradeHandlerback to summary
public InternalHttpUpgradeHandler getInternalUpgradeHandler(SocketWrapperBase<?> socketWrapper, Adapter adapter, Request request)
Parameters
socketWrapper:SocketWrapperBase<?>

The socket

adapter:Adapter

The Adapter to use to configure the new upgrade handler

request:Request

A copy (may be incomplete) of the request that triggered the upgrade

Returns:InternalHttpUpgradeHandler

An instance of the HTTP upgrade handler for this protocol

getProcessorback to summary
public Processor getProcessor(SocketWrapperBase<?> socketWrapper, Adapter adapter)
Parameters
socketWrapper:SocketWrapperBase<?>

The socketWrapper for the connection that requires a processor

adapter:Adapter

The Adapter instance that provides access to the standard Engine/Host/Context/Wrapper processing chain

Returns:Processor

A processor instance for processing a connection using this protocol.

setHttp11Protocolback to summary
public default void setHttp11Protocol(AbstractHttp11Protocol<?> protocol)

Configure the HTTP/1.1 protocol that this UpgradeProcotol is nested under. Connections passed to this UpgradeProtocol via HTTP upgrade will have been initially handled by this HTTP/1.1 protocol implementation.

The default implementation is a NO-OP.

Parameters
protocol:AbstractHttp11Protocol<?>

The HTTP/1.1 protocol implementation that will initially handle any connections passed to this UpgradeProtocol via the HTTP upgrade mechanism