Package org.apache.coyote.http2
Class Http2AsyncUpgradeHandler
java.lang.Object
org.apache.coyote.http2.Http2AsyncUpgradeHandler
- All Implemented Interfaces:
HttpUpgradeHandler,InternalHttpUpgradeHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicIntegerprotected final Stringprotected static final intprotected static final intprotected static final byte[]protected final org.apache.coyote.http2.ConnectionSettingsLocalLocal settings are settings defined by Tomcat and sent to the client that the client must use when communicating with Tomcat.protected static final Logprotected static final byte[]protected static final byte[]protected final Http2Protocolprotected static final byte[]protected static final StringManagerprotected SocketWrapperBase<?> -
Constructor Summary
ConstructorsConstructorDescriptionHttp2AsyncUpgradeHandler(Http2Protocol protocol, Adapter adapter, Request coyoteRequest) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]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) default booleanfill(boolean block, byte[] data) booleanfill(boolean block, byte[] data, int offset, int length) default booleanfill(boolean block, ByteBuffer data, int len) protected final Stringprotected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffersgetHeaderFrameBuffers(int initialPayloadSize) protected org.apache.coyote.http2.HpackEncoderintprotected org.apache.coyote.http2.Http2Parserprotected org.apache.coyote.http2.Http2UpgradeHandler.PingManagerprotected final intvoidprotected voidbooleanvoidheadersContinue(int payloadSize, boolean endOfHeaders) voidheadersEnd(int streamId) org.apache.coyote.http2.HpackDecoder.HeaderEmitterheadersStart(int streamId, boolean headersEndStream) 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.voidpause()voidpingReceive(byte[] payload, boolean ack) 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 voidvoidreceivedEndOfStream(int streamId) voidreprioritise(int streamId, int parentStreamId, boolean exclusive, int weight) voidreset(int streamId, long errorCode) protected voidsetConnectionTimeoutForStreamCount(int streamCount) voidsetSocketWrapper(SocketWrapperBase<?> wrapper) voidsetSslSupport(SSLSupport sslSupport) voidsetting(org.apache.coyote.http2.Setting setting, long value) voidsettingsEnd(boolean ack) startRequestBodyFrame(int streamId, int payloadSize, boolean endOfStream) voidswallowed(int streamId, org.apache.coyote.http2.FrameType frameType, int flags, int size) voidswallowedPadding(int streamId, int paddingLength) voidtimeoutAsync(long now) upgradeDispatch(SocketEvent status) protected voidwriteGoAwayFrame(int maxStreamId, long errorCode, byte[] debugMsg) protected voidWrite the initial settings frame and any necessary supporting frames.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.coyote.http11.upgrade.InternalHttpUpgradeHandler
getUpgradeInfo
-
Field Details
-
log
-
sm
-
FLAG_END_OF_STREAM
protected static final int FLAG_END_OF_STREAM- See Also:
-
FLAG_END_OF_HEADERS
protected static final int FLAG_END_OF_HEADERS- See Also:
-
PING
protected static final byte[] PING -
PING_ACK
protected static final byte[] PING_ACK -
SETTINGS_ACK
protected static final byte[] SETTINGS_ACK -
GOAWAY
protected static final byte[] GOAWAY -
connectionId
-
protocol
-
socketWrapper
-
localSettings
protected final org.apache.coyote.http2.ConnectionSettingsLocal localSettingsLocal settings are settings defined by Tomcat and sent to the client that the client must use when communicating with Tomcat. -
activeRemoteStreamCount
-
-
Constructor Details
-
Http2AsyncUpgradeHandler
-
-
Method Details
-
getParser
-
getPingManager
protected org.apache.coyote.http2.Http2UpgradeHandler.PingManager getPingManager() -
hasAsyncIO
public boolean hasAsyncIO() -
processConnection
protected void processConnection(WebConnection webConnection, org.apache.coyote.http2.Stream stream) -
writeSettings
protected 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). -
writeGoAwayFrame
protected void writeGoAwayFrame(int maxStreamId, long errorCode, byte[] debugMsg) throws IOException - Throws:
IOException
-
getHeaderFrameBuffers
protected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffers getHeaderFrameBuffers(int initialPayloadSize) -
settingsEnd
- Throws:
IOException
-
processSendfile
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
-
init
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 interfaceHttpUpgradeHandler- Parameters:
webConnection- The connection that has been upgraded
-
processStreamOnContainerThread
protected void processStreamOnContainerThread(org.apache.coyote.http2.Stream stream) -
setSocketWrapper
- Specified by:
setSocketWrapperin interfaceInternalHttpUpgradeHandler
-
setSslSupport
- Specified by:
setSslSupportin interfaceInternalHttpUpgradeHandler
-
upgradeDispatch
- Specified by:
upgradeDispatchin interfaceInternalHttpUpgradeHandler
-
setConnectionTimeoutForStreamCount
protected void setConnectionTimeoutForStreamCount(int streamCount) -
timeoutAsync
public void timeoutAsync(long now) - Specified by:
timeoutAsyncin interfaceInternalHttpUpgradeHandler
-
pause
public void pause()- Specified by:
pausein interfaceInternalHttpUpgradeHandler
-
destroy
public void destroy()Description copied from interface:javax.servlet.http.HttpUpgradeHandlerThis method is called after the upgraded connection has been closed.- Specified by:
destroyin interfaceHttpUpgradeHandler
-
createWindowUpdateForSettings
protected byte[] createWindowUpdateForSettings()- Returns:
- The WINDOW_UPDATE frame if one is required or an empty array if no WINDOW_UPDATE is required.
-
doWriteHeaders
protected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffers doWriteHeaders(org.apache.coyote.http2.Stream stream, int pushedStreamId, MimeHeaders mimeHeaders, boolean endOfStream, int payloadSize) throws IOException - Throws:
IOException
-
getHpackEncoder
protected org.apache.coyote.http2.HpackEncoder getHpackEncoder() -
handleAppInitiatedIOException
- Throws:
IOException
-
processWrites
- Throws:
IOException
-
incrementWindowSize
protected void incrementWindowSize(int increment) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
getConnectionId
-
getWeight
protected final int getWeight() -
fill
- Throws:
IOException
-
getMaxFrameSize
public int getMaxFrameSize() -
getHpackDecoder
-
startRequestBodyFrame
public ByteBuffer startRequestBodyFrame(int streamId, int payloadSize, boolean endOfStream) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
endRequestBodyFrame
public void endRequestBodyFrame(int streamId) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
receivedEndOfStream
public void receivedEndOfStream(int streamId) throws org.apache.coyote.http2.ConnectionException - Throws:
org.apache.coyote.http2.ConnectionException
-
swallowedPadding
public void swallowedPadding(int streamId, int paddingLength) throws org.apache.coyote.http2.ConnectionException, IOException - Throws:
org.apache.coyote.http2.ConnectionExceptionIOException
-
headersStart
public org.apache.coyote.http2.HpackDecoder.HeaderEmitter headersStart(int streamId, boolean headersEndStream) throws org.apache.coyote.http2.Http2Exception, IOException - Throws:
org.apache.coyote.http2.Http2ExceptionIOException
-
reprioritise
public void reprioritise(int streamId, int parentStreamId, boolean exclusive, int weight) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
headersContinue
public void headersContinue(int payloadSize, boolean endOfHeaders) -
headersEnd
public void headersEnd(int streamId) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
reset
public void reset(int streamId, long errorCode) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
setting
public void setting(org.apache.coyote.http2.Setting setting, long value) throws org.apache.coyote.http2.ConnectionException - Throws:
org.apache.coyote.http2.ConnectionException
-
pingReceive
- Throws:
IOException
-
goaway
-
incrementWindowSize
public void incrementWindowSize(int streamId, int increment) throws org.apache.coyote.http2.Http2Exception - Throws:
org.apache.coyote.http2.Http2Exception
-
swallowed
public void swallowed(int streamId, org.apache.coyote.http2.FrameType frameType, int flags, int size) throws IOException - Throws:
IOException
-
fill
- Throws:
IOException
-
fill
- Throws:
IOException
-