Package org.apache.coyote.http2
Class Http2Protocol
- java.lang.Object
-
- org.apache.coyote.http2.Http2Protocol
-
- All Implemented Interfaces:
UpgradeProtocol
public class Http2Protocol extends java.lang.Object implements UpgradeProtocol
-
-
Constructor Summary
Constructors Constructor Description Http2Protocol()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(Request request)Allows the implementation to examine the request and accept or reject it based on what it finds.java.lang.StringgetAllowedTrailerHeaders()byte[]getAlpnIdentifier()java.lang.StringgetAlpnName()java.lang.StringgetCompressibleMimeType()java.lang.String[]getCompressibleMimeTypes()java.lang.StringgetCompression()protected intgetCompressionLevel()intgetCompressionMinSize()java.lang.StringgetHttpUpgradeName(boolean isSSLEnabled)intgetInitialWindowSize()booleangetInitiatePingDisabled()InternalHttpUpgradeHandlergetInternalUpgradeHandler(SocketWrapperBase<?> socketWrapper, Adapter adapter, Request coyoteRequest)longgetKeepAliveTimeout()intgetMaxConcurrentStreamExecution()longgetMaxConcurrentStreams()intgetMaxHeaderCount()intgetMaxHeaderSize()intgetMaxTrailerCount()intgetMaxTrailerSize()java.lang.StringgetNoCompressionUserAgents()protected java.util.regex.PatterngetNoCompressionUserAgentsPattern()ProcessorgetProcessor(SocketWrapperBase<?> socketWrapper, Adapter adapter)longgetReadTimeout()booleangetUseSendfile()longgetWriteTimeout()voidsetAllowedTrailerHeaders(java.lang.String commaSeparatedHeaders)voidsetCompressibleMimeType(java.lang.String valueS)voidsetCompression(java.lang.String compression)voidsetCompressionMinSize(int compressionMinSize)voidsetInitialWindowSize(int initialWindowSize)voidsetInitiatePingDisabled(boolean initiatePingDisabled)voidsetKeepAliveTimeout(long keepAliveTimeout)voidsetMaxConcurrentStreamExecution(int maxConcurrentStreamExecution)voidsetMaxConcurrentStreams(long maxConcurrentStreams)voidsetMaxHeaderCount(int maxHeaderCount)voidsetMaxHeaderSize(int maxHeaderSize)voidsetMaxTrailerCount(int maxTrailerCount)voidsetMaxTrailerSize(int maxTrailerSize)voidsetNoCompressionUserAgents(java.lang.String noCompressionUserAgents)voidsetReadTimeout(long readTimeout)voidsetUseSendfile(boolean useSendfile)voidsetWriteTimeout(long writeTimeout)booleanuseCompression(Request request, Response response)
-
-
-
Method Detail
-
getHttpUpgradeName
public java.lang.String getHttpUpgradeName(boolean isSSLEnabled)
- Specified by:
getHttpUpgradeNamein interfaceUpgradeProtocol- 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
nullif upgrade via an HTTP/1.1 upgrade request is not supported.
-
getAlpnIdentifier
public byte[] getAlpnIdentifier()
- Specified by:
getAlpnIdentifierin interfaceUpgradeProtocol- Returns:
- The byte sequence as listed in the IANA registry for this
protocol or
nullif upgrade via ALPN is not supported.
-
getAlpnName
public java.lang.String getAlpnName()
- Specified by:
getAlpnNamein interfaceUpgradeProtocol- 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. IfUpgradeProtocol.getAlpnIdentifier()returns some other byte sequence, then this method returns the empty string. If upgrade via ALPN is not supported thennullis returned.
-
getProcessor
public Processor getProcessor(SocketWrapperBase<?> socketWrapper, Adapter adapter)
- Specified by:
getProcessorin interfaceUpgradeProtocol- Parameters:
socketWrapper- The socketWrapper for the connection that requires a processoradapter- 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:
getInternalUpgradeHandlerin interfaceUpgradeProtocol- Parameters:
socketWrapper- The socketadapter- The Adapter to use to configure the new upgrade handlercoyoteRequest- 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:UpgradeProtocolAllows the implementation to examine the request and accept or reject it based on what it finds.- Specified by:
acceptin interfaceUpgradeProtocol- Parameters:
request- The request that included an upgrade header for this protocol- Returns:
trueif the request is accepted, otherwisefalse
-
getReadTimeout
public long getReadTimeout()
-
setReadTimeout
public void setReadTimeout(long readTimeout)
-
getKeepAliveTimeout
public long getKeepAliveTimeout()
-
setKeepAliveTimeout
public void setKeepAliveTimeout(long keepAliveTimeout)
-
getWriteTimeout
public long getWriteTimeout()
-
setWriteTimeout
public void setWriteTimeout(long writeTimeout)
-
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(java.lang.String commaSeparatedHeaders)
-
getAllowedTrailerHeaders
public java.lang.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()
-
setInitiatePingDisabled
public void setInitiatePingDisabled(boolean initiatePingDisabled)
-
getInitiatePingDisabled
public boolean getInitiatePingDisabled()
-
setCompression
public void setCompression(java.lang.String compression)
-
getCompression
public java.lang.String getCompression()
-
getCompressionLevel
protected int getCompressionLevel()
-
getNoCompressionUserAgents
public java.lang.String getNoCompressionUserAgents()
-
getNoCompressionUserAgentsPattern
protected java.util.regex.Pattern getNoCompressionUserAgentsPattern()
-
setNoCompressionUserAgents
public void setNoCompressionUserAgents(java.lang.String noCompressionUserAgents)
-
getCompressibleMimeType
public java.lang.String getCompressibleMimeType()
-
setCompressibleMimeType
public void setCompressibleMimeType(java.lang.String valueS)
-
getCompressibleMimeTypes
public java.lang.String[] getCompressibleMimeTypes()
-
getCompressionMinSize
public int getCompressionMinSize()
-
setCompressionMinSize
public void setCompressionMinSize(int compressionMinSize)
-
-