Http2Protocol (Apache Tomcat 9.0.111 API Documentation)
Description: declaration: package: org.apache.coyote.http2, class: Http2Protocol

# Class Http2Protocol

java.lang.Object
org.apache.coyote.http2.Http2Protocol

All Implemented Interfaces:
  `UpgradeProtocol`

public class Http2Protocol extends Object implements UpgradeProtocol

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Http2Protocol()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `accept(Request request)`
  Allows the implementation to examine the request and accept or reject it based on what it finds.
  `String`
  `getAllowedTrailerHeaders()`
  `byte[]`
  `getAlpnIdentifier()`
  `String`
  `getAlpnName()`
  `String`
  `getCompressibleMimeType()`
  `String[]`
  `getCompressibleMimeTypes()`
  `String`
  `getCompression()`
  `protected int`
  `getCompressionLevel()`
  `int`
  `getCompressionMinSize()`
  `ContinueResponseTiming`
  `getContinueResponseTimingInternal()`
  `boolean`
  `getDiscardRequestsAndResponses()`
  `RequestGroupInfo`
  `getGlobal()`
  `AbstractProtocol<?>`
  `getHttp11Protocol()`
  `String`
  `getHttpUpgradeName(boolean isSSLEnabled)`
  `int`
  `getInitialWindowSize()`
  `boolean`
  `getInitiatePingDisabled()`
  `InternalHttpUpgradeHandler`
  `getInternalUpgradeHandler(SocketWrapperBase<?> socketWrapper, Adapter adapter, Request coyoteRequest)`
  `long`
  `getKeepAliveTimeout()`
  `int`
  `getMaxConcurrentStreamExecution()`
  `long`
  `getMaxConcurrentStreams()`
  `int`
  `getMaxHeaderCount()`
  `int`
  `getMaxHeaderSize()`
  `int`
  `getMaxTrailerCount()`
  `int`
  `getMaxTrailerSize()`
  `boolean`
  `getNoCompressionStrongETag()`
  Deprecated.
  `String`
  `getNoCompressionUserAgents()`
  `protected Pattern`
  `getNoCompressionUserAgentsPattern()`
  `int`
  `getOverheadContinuationThreshold()`
  `int`
  `getOverheadCountFactor()`
  `int`
  `getOverheadDataThreshold()`
  `int`
  `getOverheadResetFactor()`
  `int`
  `getOverheadWindowUpdateThreshold()`
  `Processor`
  `getProcessor(SocketWrapperBase<?> socketWrapper, Adapter adapter)`
  `long`
  `getReadTimeout()`
  `long`
  `getStreamReadTimeout()`
  `long`
  `getStreamWriteTimeout()`
  `String`
  `getUpgradeProtocolName()`
  `boolean`
  `getUseSendfile()`
  `long`
  `getWriteTimeout()`
  `void`
  `setAllowedTrailerHeaders(String commaSeparatedHeaders)`
  `void`
  `setCompressibleMimeType(String valueS)`
  `void`
  `setCompression(String compression)`
  `void`
  `setCompressionMinSize(int compressionMinSize)`
  `void`
  `setDiscardRequestsAndResponses(boolean discardRequestsAndResponses)`
  `void`
  `setHttp11Protocol(AbstractHttp11Protocol<?> http11Protocol)`
  Configure the HTTP/1.1 protocol that this UpgradeProcotol is nested under.
  `void`
  `setInitialWindowSize(int initialWindowSize)`
  `void`
  `setInitiatePingDisabled(boolean initiatePingDisabled)`
  `void`
  `setKeepAliveTimeout(long keepAliveTimeout)`
  `void`
  `setMaxConcurrentStreamExecution(int maxConcurrentStreamExecution)`
  `void`
  `setMaxConcurrentStreams(long maxConcurrentStreams)`
  `void`
  `setMaxHeaderCount(int maxHeaderCount)`
  `void`
  `setMaxHeaderSize(int maxHeaderSize)`
  `void`
  `setMaxTrailerCount(int maxTrailerCount)`
  `void`
  `setMaxTrailerSize(int maxTrailerSize)`
  `void`
  `setNoCompressionStrongETag(boolean noCompressionStrongETag)`
  Deprecated.
  `void`
  `setNoCompressionUserAgents(String noCompressionUserAgents)`
  `void`
  `setOverheadContinuationThreshold(int overheadContinuationThreshold)`
  `void`
  `setOverheadCountFactor(int overheadCountFactor)`
  `void`
  `setOverheadDataThreshold(int overheadDataThreshold)`
  `void`
  `setOverheadResetFactor(int overheadResetFactor)`
  `void`
  `setOverheadWindowUpdateThreshold(int overheadWindowUpdateThreshold)`
  `void`
  `setReadTimeout(long readTimeout)`
  `void`
  `setStreamReadTimeout(long streamReadTimeout)`
  `void`
  `setStreamWriteTimeout(long streamWriteTimeout)`
  `void`
  `setUseSendfile(boolean useSendfile)`
  `void`
  `setWriteTimeout(long writeTimeout)`
  `boolean`
  `useCompression(Request request, Response response)`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface UpgradeProtocol

  `setHttp11Protocol`

- ## Constructor Details

  - ### Http2Protocol

    public Http2Protocol()

- ## Method Details

  - ### getHttpUpgradeName

    public String getHttpUpgradeName(boolean isSSLEnabled)
    Specified by:
      `getHttpUpgradeName` in interface `UpgradeProtocol`
    Parameters:
      `isSSLEnabled` - 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:
      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.

  - ### getAlpnIdentifier

    public byte[] getAlpnIdentifier()
    Specified by:
      `getAlpnIdentifier` in interface `UpgradeProtocol`
    Returns:
      The byte sequence as listed in the IANA registry for this protocol or `null` if upgrade via ALPN is not supported.

  - ### getAlpnName

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

  - ### getProcessor

    public Processor getProcessor(SocketWrapperBase<?> socketWrapper, Adapter adapter)
    Specified by:
      `getProcessor` in interface `UpgradeProtocol`
    Parameters:
      `socketWrapper` - The socketWrapper for the connection that requires a processor
      `adapter` - The Adapter instance that provides access to the standard Engine/Host/Context/Wrapper processing chain
    Returns:
      A processor instance for processing a connection using this protocol.

  - ### getInternalUpgradeHandler

    public InternalHttpUpgradeHandler getInternalUpgradeHandler(SocketWrapperBase<?> socketWrapper, Adapter adapter, Request coyoteRequest)
    Specified by:
      `getInternalUpgradeHandler` in interface `UpgradeProtocol`
    Parameters:
      `socketWrapper` - The socket
      `adapter` - The Adapter to use to configure the new upgrade handler
      `coyoteRequest` - A copy (may be incomplete) of the request that triggered the upgrade
    Returns:
      An instance of the HTTP upgrade handler for this protocol

  - ### accept

    public boolean accept(Request request)
    Description copied from interface: `UpgradeProtocol`
    Allows the implementation to examine the request and accept or reject it based on what it finds.
    Specified by:
      `accept` in interface `UpgradeProtocol`
    Parameters:
      `request` - The request that included an upgrade header for this protocol
    Returns:
      `true` if the request is accepted, otherwise `false`

  - ### getReadTimeout

    public long getReadTimeout()

  - ### setReadTimeout

    public void setReadTimeout(long readTimeout)

  - ### getWriteTimeout

    public long getWriteTimeout()

  - ### setWriteTimeout

    public void setWriteTimeout(long writeTimeout)

  - ### getKeepAliveTimeout

    public long getKeepAliveTimeout()

  - ### setKeepAliveTimeout

    public void setKeepAliveTimeout(long keepAliveTimeout)

  - ### getStreamReadTimeout

    public long getStreamReadTimeout()

  - ### setStreamReadTimeout

    public void setStreamReadTimeout(long streamReadTimeout)

  - ### getStreamWriteTimeout

    public long getStreamWriteTimeout()

  - ### setStreamWriteTimeout

    public void setStreamWriteTimeout(long streamWriteTimeout)

  - ### getMaxConcurrentStreams

    public long getMaxConcurrentStreams()

  - ### setMaxConcurrentStreams

    public void setMaxConcurrentStreams(long maxConcurrentStreams)

  - ### getMaxConcurrentStreamExecution

    public int getMaxConcurrentStreamExecution()

  - ### setMaxConcurrentStreamExecution

    public void setMaxConcurrentStreamExecution(int maxConcurrentStreamExecution)

  - ### getInitialWindowSize

    public int getInitialWindowSize()

  - ### setInitialWindowSize

    public void setInitialWindowSize(int initialWindowSize)

  - ### getUseSendfile

    public boolean getUseSendfile()

  - ### setUseSendfile

    public void setUseSendfile(boolean useSendfile)

  - ### setAllowedTrailerHeaders

    public void setAllowedTrailerHeaders(String commaSeparatedHeaders)

  - ### getAllowedTrailerHeaders

    public String getAllowedTrailerHeaders()

  - ### setMaxHeaderCount

    public void setMaxHeaderCount(int maxHeaderCount)

  - ### getMaxHeaderCount

    public int getMaxHeaderCount()

  - ### setMaxHeaderSize

    public void setMaxHeaderSize(int maxHeaderSize)

  - ### getMaxHeaderSize

    public int getMaxHeaderSize()

  - ### setMaxTrailerCount

    public void setMaxTrailerCount(int maxTrailerCount)

  - ### getMaxTrailerCount

    public int getMaxTrailerCount()

  - ### setMaxTrailerSize

    public void setMaxTrailerSize(int maxTrailerSize)

  - ### getMaxTrailerSize

    public int getMaxTrailerSize()

  - ### getOverheadCountFactor

    public int getOverheadCountFactor()

  - ### setOverheadCountFactor

    public void setOverheadCountFactor(int overheadCountFactor)

  - ### getOverheadResetFactor

    public int getOverheadResetFactor()

  - ### setOverheadResetFactor

    public void setOverheadResetFactor(int overheadResetFactor)

  - ### getOverheadContinuationThreshold

    public int getOverheadContinuationThreshold()

  - ### setOverheadContinuationThreshold

    public void setOverheadContinuationThreshold(int overheadContinuationThreshold)

  - ### getOverheadDataThreshold

    public int getOverheadDataThreshold()

  - ### setOverheadDataThreshold

    public void setOverheadDataThreshold(int overheadDataThreshold)

  - ### getOverheadWindowUpdateThreshold

    public int getOverheadWindowUpdateThreshold()

  - ### setOverheadWindowUpdateThreshold

    public void setOverheadWindowUpdateThreshold(int overheadWindowUpdateThreshold)

  - ### setInitiatePingDisabled

    public void setInitiatePingDisabled(boolean initiatePingDisabled)

  - ### getInitiatePingDisabled

    public boolean getInitiatePingDisabled()

  - ### setCompression

    public void setCompression(String compression)

  - ### getCompression

    public String getCompression()

  - ### getCompressionLevel

    protected int getCompressionLevel()

  - ### getNoCompressionUserAgents

    public String getNoCompressionUserAgents()

  - ### getNoCompressionUserAgentsPattern

    protected Pattern getNoCompressionUserAgentsPattern()

  - ### setNoCompressionUserAgents

    public void setNoCompressionUserAgents(String noCompressionUserAgents)

  - ### getCompressibleMimeType

    public String getCompressibleMimeType()

  - ### setCompressibleMimeType

    public void setCompressibleMimeType(String valueS)

  - ### getCompressibleMimeTypes

    public String[] getCompressibleMimeTypes()

  - ### getCompressionMinSize

    public int getCompressionMinSize()

  - ### setCompressionMinSize

    public void setCompressionMinSize(int compressionMinSize)

  - ### getNoCompressionStrongETag

    @Deprecated public boolean getNoCompressionStrongETag()
    Deprecated.

  - ### setNoCompressionStrongETag

    @Deprecated public void setNoCompressionStrongETag(boolean noCompressionStrongETag)
    Deprecated.

  - ### useCompression

    public boolean useCompression(Request request, Response response)

  - ### getContinueResponseTimingInternal

    public ContinueResponseTiming getContinueResponseTimingInternal()

  - ### getHttp11Protocol

    public AbstractProtocol<?> getHttp11Protocol()

  - ### setHttp11Protocol

    public void setHttp11Protocol(AbstractHttp11Protocol<?> http11Protocol)
    Description copied from interface: `UpgradeProtocol`
    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.

    Specified by:
      `setHttp11Protocol` in interface `UpgradeProtocol`
    Parameters:
      `http11Protocol` - The HTTP/1.1 protocol implementation that will initially handle any connections passed to this UpgradeProtocol via the HTTP upgrade mechanism

  - ### getUpgradeProtocolName

    public String getUpgradeProtocolName()

  - ### getGlobal

    public RequestGroupInfo getGlobal()

  - ### getDiscardRequestsAndResponses

    public boolean getDiscardRequestsAndResponses()

  - ### setDiscardRequestsAndResponses

    public void setDiscardRequestsAndResponses(boolean discardRequestsAndResponses)