Package org.apache.coyote.http2
Class Http2AsyncUpgradeHandler
- java.lang.Object
- 
- org.apache.coyote.http2.Http2AsyncUpgradeHandler
 
- 
- All Implemented Interfaces:
- HttpUpgradeHandler,- InternalHttpUpgradeHandler
 
 public class Http2AsyncUpgradeHandler extends java.lang.Object
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classHttp2AsyncUpgradeHandler.AsyncPingManagerprotected classHttp2AsyncUpgradeHandler.SendfileCompletionHandler
 - 
Field SummaryFields Modifier and Type Field Description protected java.util.concurrent.atomic.AtomicIntegeractiveRemoteStreamCountprotected java.lang.StringconnectionIdprotected static intFLAG_END_OF_HEADERSprotected static intFLAG_END_OF_STREAMprotected static byte[]GOAWAYprotected org.apache.coyote.http2.ConnectionSettingsLocallocalSettingsLocal settings are settings defined by Tomcat and sent to the client that the client must use when communicating with Tomcat.protected static Loglogprotected static byte[]PINGprotected static byte[]PING_ACKprotected Http2Protocolprotocolprotected static byte[]SETTINGS_ACKprotected static StringManagersmprotected SocketWrapperBase<?>socketWrapperprotected UserDataHelperuserDataHelperprotected java.util.concurrent.locks.ConditionwindowAllocationAvailableprotected java.util.concurrent.locks.LockwindowAllocationLock
 - 
Constructor SummaryConstructors Constructor Description Http2AsyncUpgradeHandler(Http2Protocol protocol, Adapter adapter, Request coyoteRequest)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Default Methods Deprecated Methods Modifier and Type Method Description protected byte[]createWindowUpdateForSettings()voiddestroy()This method is called after the upgraded connection has been closed.protected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffersdoWriteHeaders(org.apache.coyote.http2.Stream stream, int pushedStreamId, MimeHeaders mimeHeaders, boolean endOfStream, int payloadSize)voidendRequestBodyFrame(int streamId, int dataLength)default booleanfill(boolean block, byte[] data)booleanfill(boolean block, byte[] data, int offset, int length)default booleanfill(boolean block, java.nio.ByteBuffer data, int len)protected java.lang.StringgetConnectionId()protected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffersgetHeaderFrameBuffers(int initialPayloadSize)HpackDecodergetHpackDecoder()protected org.apache.coyote.http2.HpackEncodergetHpackEncoder()intgetMaxFrameSize()protected org.apache.coyote.http2.Http2ParsergetParser(java.lang.String connectionId)protected org.apache.coyote.http2.Http2UpgradeHandler.PingManagergetPingManager()voidgoaway(int lastStreamId, long errorCode, java.lang.String debugData)protected voidhandleAppInitiatedIOException(java.io.IOException ioe)booleanhasAsyncIO()voidheadersContinue(int payloadSize, boolean endOfHeaders)voidheadersEnd(int streamId, boolean endOfStream)org.apache.coyote.http2.HpackDecoder.HeaderEmitterheadersStart(int streamId, boolean headersEndStream)voidincreaseOverheadCount(org.apache.coyote.http2.FrameType frameType)protected voidincrementWindowSize(int increment)voidincrementWindowSize(int streamId, int increment)voidinit(WebConnection webConnection)This method is called once the request/response pair whereHttpServletRequest.upgrade(Class)is called has completed processing and is the point where control of the connection passes from the container to theHttpUpgradeHandler.voidonSwallowedDataFramePayload(int streamId, int swallowedDataBytesCount)voidonSwallowedUnknownFrame(int streamId, int frameTypeId, int flags, int size)voidpause()voidpingReceive(byte[] payload, boolean ack)voidpriorityUpdate(int prioritizedStreamID, Priority p)protected voidprocessConnection(WebConnection webConnection, org.apache.coyote.http2.Stream stream)protected SendfileStateprocessSendfile(org.apache.coyote.http2.SendfileData sendfile)Process send file (if supported) for the given stream.protected voidprocessStreamOnContainerThread(org.apache.coyote.http2.Stream stream)protected voidprocessWrites()voidreceivedEndOfStream(int streamId)voidreprioritise(int streamId, int parentStreamId, boolean exclusive, int weight)Deprecated.Unused.voidreset(int streamId, long errorCode)protected voidsentEndOfStream(org.apache.coyote.http2.Stream stream)protected voidsetConnectionTimeoutForStreamCount(int streamCount)voidsetSocketWrapper(SocketWrapperBase<?> wrapper)voidsetSslSupport(SSLSupport sslSupport)voidsetting(org.apache.coyote.http2.Setting setting, long value)voidsettingsEnd(boolean ack)java.nio.ByteBufferstartRequestBodyFrame(int streamId, int payloadSize, boolean endOfStream)voidtimeoutAsync(long now)AbstractEndpoint.Handler.SocketStateupgradeDispatch(SocketEvent status)protected voidwriteGoAwayFrame(int maxStreamId, long errorCode, byte[] debugMsg)protected voidwriteSettings()Write the initial settings frame and any necessary supporting frames.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandlergetUpgradeInfo
 
- 
 
- 
- 
- 
Field Detail- 
logprotected static final Log log 
 - 
smprotected static final StringManager sm 
 - 
FLAG_END_OF_STREAMprotected static final int FLAG_END_OF_STREAM - See Also:
- Constant Field Values
 
 - 
FLAG_END_OF_HEADERSprotected static final int FLAG_END_OF_HEADERS - See Also:
- Constant Field Values
 
 - 
PINGprotected static final byte[] PING 
 - 
PING_ACKprotected static final byte[] PING_ACK 
 - 
SETTINGS_ACKprotected static final byte[] SETTINGS_ACK 
 - 
GOAWAYprotected static final byte[] GOAWAY 
 - 
connectionIdprotected final java.lang.String connectionId 
 - 
protocolprotected final Http2Protocol protocol 
 - 
socketWrapperprotected volatile SocketWrapperBase<?> socketWrapper 
 - 
localSettingsprotected final org.apache.coyote.http2.ConnectionSettingsLocal localSettings Local settings are settings defined by Tomcat and sent to the client that the client must use when communicating with Tomcat.
 - 
activeRemoteStreamCountprotected final java.util.concurrent.atomic.AtomicInteger activeRemoteStreamCount 
 - 
userDataHelperprotected final UserDataHelper userDataHelper 
 - 
windowAllocationLockprotected final java.util.concurrent.locks.Lock windowAllocationLock 
 - 
windowAllocationAvailableprotected final java.util.concurrent.locks.Condition windowAllocationAvailable 
 
- 
 - 
Constructor Detail- 
Http2AsyncUpgradeHandlerpublic Http2AsyncUpgradeHandler(Http2Protocol protocol, Adapter adapter, Request coyoteRequest) 
 
- 
 - 
Method Detail- 
getParserprotected org.apache.coyote.http2.Http2Parser getParser(java.lang.String connectionId) 
 - 
getPingManagerprotected org.apache.coyote.http2.Http2UpgradeHandler.PingManager getPingManager() 
 - 
hasAsyncIOpublic boolean hasAsyncIO() 
 - 
processConnectionprotected void processConnection(WebConnection webConnection, org.apache.coyote.http2.Stream stream) 
 - 
writeSettingsprotected void writeSettings() Write the initial settings frame and any necessary supporting frames. If the initial settings increase the initial window size, it will also be necessary to send a WINDOW_UPDATE frame to increase the size of the flow control window for the connection (stream 0).
 - 
writeGoAwayFrameprotected void writeGoAwayFrame(int maxStreamId, long errorCode, byte[] debugMsg) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
getHeaderFrameBuffersprotected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffers getHeaderFrameBuffers(int initialPayloadSize) 
 - 
settingsEndpublic void settingsEnd(boolean ack) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
processSendfileprotected SendfileState processSendfile(org.apache.coyote.http2.SendfileData sendfile) Process send file (if supported) for the given stream. The appropriate request attributes should be set before calling this method.- Parameters:
- sendfile- The stream and associated data to process
- Returns:
- The result of the send file processing
 
 - 
initpublic void init(WebConnection webConnection) Description copied from interface:javax.servlet.http.HttpUpgradeHandlerThis method is called once the request/response pair whereHttpServletRequest.upgrade(Class)is called has completed processing and is the point where control of the connection passes from the container to theHttpUpgradeHandler.- Specified by:
- initin interface- HttpUpgradeHandler
- Parameters:
- webConnection- The connection that has been upgraded
 
 - 
processStreamOnContainerThreadprotected void processStreamOnContainerThread(org.apache.coyote.http2.Stream stream) 
 - 
setSocketWrapperpublic void setSocketWrapper(SocketWrapperBase<?> wrapper) - Specified by:
- setSocketWrapperin interface- InternalHttpUpgradeHandler
 
 - 
setSslSupportpublic void setSslSupport(SSLSupport sslSupport) - Specified by:
- setSslSupportin interface- InternalHttpUpgradeHandler
 
 - 
upgradeDispatchpublic AbstractEndpoint.Handler.SocketState upgradeDispatch(SocketEvent status) - Specified by:
- upgradeDispatchin interface- InternalHttpUpgradeHandler
 
 - 
setConnectionTimeoutForStreamCountprotected void setConnectionTimeoutForStreamCount(int streamCount) 
 - 
timeoutAsyncpublic void timeoutAsync(long now) - Specified by:
- timeoutAsyncin interface- InternalHttpUpgradeHandler
 
 - 
pausepublic void pause() - Specified by:
- pausein interface- InternalHttpUpgradeHandler
 
 - 
destroypublic void destroy() Description copied from interface:javax.servlet.http.HttpUpgradeHandlerThis method is called after the upgraded connection has been closed.- Specified by:
- destroyin interface- HttpUpgradeHandler
 
 - 
createWindowUpdateForSettingsprotected byte[] createWindowUpdateForSettings() - Returns:
- The WINDOW_UPDATE frame if one is required or an empty array if no WINDOW_UPDATE is required.
 
 - 
doWriteHeadersprotected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffers doWriteHeaders(org.apache.coyote.http2.Stream stream, int pushedStreamId, MimeHeaders mimeHeaders, boolean endOfStream, int payloadSize) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
getHpackEncoderprotected org.apache.coyote.http2.HpackEncoder getHpackEncoder() 
 - 
sentEndOfStreamprotected void sentEndOfStream(org.apache.coyote.http2.Stream stream) 
 - 
handleAppInitiatedIOExceptionprotected void handleAppInitiatedIOException(java.io.IOException ioe) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
processWritesprotected void processWrites() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
incrementWindowSizeprotected void incrementWindowSize(int increment) throws org.apache.coyote.http2.Http2Exception- Throws:
- org.apache.coyote.http2.Http2Exception
 
 - 
getConnectionIdprotected final java.lang.String getConnectionId() 
 - 
increaseOverheadCountpublic void increaseOverheadCount(org.apache.coyote.http2.FrameType frameType) 
 - 
fillpublic boolean fill(boolean block, byte[] data, int offset, int length) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
getMaxFrameSizepublic int getMaxFrameSize() 
 - 
getHpackDecoderpublic HpackDecoder getHpackDecoder() 
 - 
startRequestBodyFramepublic java.nio.ByteBuffer startRequestBodyFrame(int streamId, int payloadSize, boolean endOfStream) throws org.apache.coyote.http2.Http2Exception- Throws:
- org.apache.coyote.http2.Http2Exception
 
 - 
endRequestBodyFramepublic void endRequestBodyFrame(int streamId, int dataLength) throws org.apache.coyote.http2.Http2Exception, java.io.IOException- Throws:
- org.apache.coyote.http2.Http2Exception
- java.io.IOException
 
 - 
onSwallowedDataFramePayloadpublic void onSwallowedDataFramePayload(int streamId, int swallowedDataBytesCount) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
headersStartpublic org.apache.coyote.http2.HpackDecoder.HeaderEmitter headersStart(int streamId, boolean headersEndStream) throws org.apache.coyote.http2.Http2Exception, java.io.IOException- Throws:
- org.apache.coyote.http2.Http2Exception
- java.io.IOException
 
 - 
reprioritise@Deprecated public void reprioritise(int streamId, int parentStreamId, boolean exclusive, int weight) throws org.apache.coyote.http2.Http2ExceptionDeprecated.Unused. Will be removed in Tomcat 11 onwards.Unused - NO-OP.- Parameters:
- streamId- Unused
- parentStreamId- Unused
- exclusive- Unused
- weight- Unused
- Throws:
- org.apache.coyote.http2.Http2Exception- Never thrown
 
 - 
headersContinuepublic void headersContinue(int payloadSize, boolean endOfHeaders)
 - 
headersEndpublic void headersEnd(int streamId, boolean endOfStream) throws org.apache.coyote.http2.Http2Exception- Throws:
- org.apache.coyote.http2.Http2Exception
 
 - 
receivedEndOfStreampublic void receivedEndOfStream(int streamId) throws org.apache.coyote.http2.ConnectionException- Throws:
- org.apache.coyote.http2.ConnectionException
 
 - 
resetpublic void reset(int streamId, long errorCode) throws org.apache.coyote.http2.Http2Exception- Throws:
- org.apache.coyote.http2.Http2Exception
 
 - 
settingpublic void setting(org.apache.coyote.http2.Setting setting, long value) throws org.apache.coyote.http2.ConnectionException- Throws:
- org.apache.coyote.http2.ConnectionException
 
 - 
pingReceivepublic void pingReceive(byte[] payload, boolean ack) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
goawaypublic void goaway(int lastStreamId, long errorCode, java.lang.String debugData)
 - 
incrementWindowSizepublic void incrementWindowSize(int streamId, int increment) throws org.apache.coyote.http2.Http2Exception- Throws:
- org.apache.coyote.http2.Http2Exception
 
 - 
priorityUpdatepublic void priorityUpdate(int prioritizedStreamID, Priority p) throws org.apache.coyote.http2.Http2Exception- Throws:
- org.apache.coyote.http2.Http2Exception
 
 - 
onSwallowedUnknownFramepublic void onSwallowedUnknownFrame(int streamId, int frameTypeId, int flags, int size) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
fillpublic default boolean fill(boolean block, byte[] data) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
fillpublic default boolean fill(boolean block, java.nio.ByteBuffer data, int len) throws java.io.IOException- Throws:
- java.io.IOException
 
 
- 
 
-