Class Http2AsyncUpgradeHandler

java.lang.Object
org.apache.coyote.http2.Http2AsyncUpgradeHandler
All Implemented Interfaces:
HttpUpgradeHandler, InternalHttpUpgradeHandler

public class Http2AsyncUpgradeHandler extends Object
  • Field Details Link icon

    • log Link icon

      protected static final Log log
    • sm Link icon

      protected static final StringManager sm
    • FLAG_END_OF_STREAM Link icon

      protected static final int FLAG_END_OF_STREAM
      See Also:
    • FLAG_END_OF_HEADERS Link icon

      protected static final int FLAG_END_OF_HEADERS
      See Also:
    • PING Link icon

      protected static final byte[] PING
    • PING_ACK Link icon

      protected static final byte[] PING_ACK
    • SETTINGS_ACK Link icon

      protected static final byte[] SETTINGS_ACK
    • GOAWAY Link icon

      protected static final byte[] GOAWAY
    • HEADER_SINK Link icon

      protected static final org.apache.coyote.http2.HeaderSink HEADER_SINK
    • userDataHelper Link icon

      protected static final UserDataHelper userDataHelper
    • connectionId Link icon

      protected final String connectionId
    • protocol Link icon

      protected final Http2Protocol protocol
    • socketWrapper Link icon

      protected volatile SocketWrapperBase<?> socketWrapper
    • localSettings Link icon

      protected 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.
    • activeRemoteStreamCount Link icon

      protected final AtomicInteger activeRemoteStreamCount
    • windowAllocationLock Link icon

      protected final Lock windowAllocationLock
    • windowAllocationAvailable Link icon

      protected final Condition windowAllocationAvailable
  • Constructor Details Link icon

  • Method Details Link icon

    • getParser Link icon

      protected org.apache.coyote.http2.Http2Parser getParser(String connectionId)
    • getPingManager Link icon

      protected org.apache.coyote.http2.Http2UpgradeHandler.PingManager getPingManager()
    • hasAsyncIO Link icon

      public boolean hasAsyncIO()
      Returns:
      true if able to process asynchronous IO, default is false
    • processConnection Link icon

      protected void processConnection(WebConnection webConnection, org.apache.coyote.http2.Stream stream)
    • writeSettings Link icon

      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 Link icon

      protected void writeGoAwayFrame(int maxStreamId, long errorCode, byte[] debugMsg) throws IOException
      Throws:
      IOException
    • getHeaderFrameBuffers Link icon

      protected org.apache.coyote.http2.Http2UpgradeHandler.HeaderFrameBuffers getHeaderFrameBuffers(int initialPayloadSize)
    • settingsEnd Link icon

      public void settingsEnd(boolean ack) throws IOException
      Throws:
      IOException
    • processSendfile Link icon

      protected 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
    • init Link icon

      public void init(WebConnection webConnection)
      Description copied from interface: javax.servlet.http.HttpUpgradeHandler
      This method is called once the request/response pair where HttpServletRequest.upgrade(Class) is called has completed processing and is the point where control of the connection passes from the container to the HttpUpgradeHandler.
      Specified by:
      init in interface HttpUpgradeHandler
      Parameters:
      webConnection - The connection that has been upgraded
    • processStreamOnContainerThread Link icon

      protected void processStreamOnContainerThread(org.apache.coyote.http2.Stream stream)
    • decrementActiveRemoteStreamCount Link icon

      protected void decrementActiveRemoteStreamCount(org.apache.coyote.http2.Stream stream)
    • setSocketWrapper Link icon

      public void setSocketWrapper(SocketWrapperBase<?> wrapper)
      Description copied from interface: InternalHttpUpgradeHandler
      Associate with the specified socket.
      Specified by:
      setSocketWrapper in interface InternalHttpUpgradeHandler
      Parameters:
      wrapper - the socket
    • setSslSupport Link icon

      public void setSslSupport(SSLSupport sslSupport)
      Description copied from interface: InternalHttpUpgradeHandler
      Associate with the specified SSL support.
      Specified by:
      setSslSupport in interface InternalHttpUpgradeHandler
      Parameters:
      sslSupport - the SSL support
    • upgradeDispatch Link icon

      public AbstractEndpoint.Handler.SocketState upgradeDispatch(SocketEvent status)
      Description copied from interface: InternalHttpUpgradeHandler
      Process the specified event.
      Specified by:
      upgradeDispatch in interface InternalHttpUpgradeHandler
      Parameters:
      status - the event
      Returns:
      the status following the event
    • setConnectionTimeoutForStreamCount Link icon

      protected void setConnectionTimeoutForStreamCount(int streamCount)
    • timeoutAsync Link icon

      public void timeoutAsync(long now)
      Description copied from interface: InternalHttpUpgradeHandler
      Check for a possible timeout.
      Specified by:
      timeoutAsync in interface InternalHttpUpgradeHandler
      Parameters:
      now - the time to use for the timeout check
    • pause Link icon

      public void pause()
      Description copied from interface: InternalHttpUpgradeHandler
      Pause processing for the connection.
      Specified by:
      pause in interface InternalHttpUpgradeHandler
    • destroy Link icon

      public void destroy()
      Description copied from interface: javax.servlet.http.HttpUpgradeHandler
      This method is called after the upgraded connection has been closed.
      Specified by:
      destroy in interface HttpUpgradeHandler
    • createWindowUpdateForSettings Link icon

      protected byte[] createWindowUpdateForSettings()
      Returns:
      The WINDOW_UPDATE frame if one is required or an empty array if no WINDOW_UPDATE is required.
    • doWriteHeaders Link icon

      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 Link icon

      protected org.apache.coyote.http2.HpackEncoder getHpackEncoder()
    • sentEndOfStream Link icon

      protected void sentEndOfStream(org.apache.coyote.http2.Stream stream)
    • handleAppInitiatedIOException Link icon

      protected void handleAppInitiatedIOException(IOException ioe) throws IOException
      Throws:
      IOException
    • processWrites Link icon

      protected void processWrites() throws IOException
      Throws:
      IOException
    • incrementWindowSize Link icon

      protected void incrementWindowSize(int increment) throws org.apache.coyote.http2.Http2Exception
      Throws:
      org.apache.coyote.http2.Http2Exception
    • getConnectionId Link icon

      protected final String getConnectionId()
    • increaseOverheadCount Link icon

      public void increaseOverheadCount(org.apache.coyote.http2.FrameType frameType)
    • fill Link icon

      public boolean fill(boolean block, byte[] data, int offset, int length) throws IOException
      Throws:
      IOException
    • getMaxFrameSize Link icon

      public int getMaxFrameSize()
    • getHpackDecoder Link icon

      public HpackDecoder getHpackDecoder()
    • startRequestBodyFrame Link icon

      public ByteBuffer startRequestBodyFrame(int streamId, int payloadSize, boolean endOfStream) throws org.apache.coyote.http2.Http2Exception
      Throws:
      org.apache.coyote.http2.Http2Exception
    • endRequestBodyFrame Link icon

      public void endRequestBodyFrame(int streamId, int dataLength) throws org.apache.coyote.http2.Http2Exception, IOException
      Throws:
      org.apache.coyote.http2.Http2Exception
      IOException
    • onSwallowedDataFramePayload Link icon

      public void onSwallowedDataFramePayload(int streamId, int swallowedDataBytesCount) throws IOException
      Throws:
      IOException
    • headersStart Link icon

      public org.apache.coyote.http2.HpackDecoder.HeaderEmitter headersStart(int streamId, boolean headersEndStream) throws org.apache.coyote.http2.Http2Exception, IOException
      Throws:
      org.apache.coyote.http2.Http2Exception
      IOException
    • reprioritise Link icon

      @Deprecated public void reprioritise(int streamId, int parentStreamId, boolean exclusive, int weight) throws org.apache.coyote.http2.Http2Exception
      Deprecated.
      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
    • headersContinue Link icon

      public void headersContinue(int payloadSize, boolean endOfHeaders)
    • headersEnd Link icon

      public void headersEnd(int streamId, boolean endOfStream) throws org.apache.coyote.http2.Http2Exception
      Throws:
      org.apache.coyote.http2.Http2Exception
    • receivedEndOfStream Link icon

      public void receivedEndOfStream(int streamId) throws org.apache.coyote.http2.ConnectionException
      Throws:
      org.apache.coyote.http2.ConnectionException
    • reset Link icon

      public void reset(int streamId, long errorCode) throws org.apache.coyote.http2.Http2Exception
      Throws:
      org.apache.coyote.http2.Http2Exception
    • setting Link icon

      public void setting(org.apache.coyote.http2.Setting setting, long value) throws org.apache.coyote.http2.ConnectionException
      Throws:
      org.apache.coyote.http2.ConnectionException
    • pingReceive Link icon

      public void pingReceive(byte[] payload, boolean ack) throws IOException
      Throws:
      IOException
    • goaway Link icon

      public void goaway(int lastStreamId, long errorCode, String debugData)
    • incrementWindowSize Link icon

      public void incrementWindowSize(int streamId, int increment) throws org.apache.coyote.http2.Http2Exception
      Throws:
      org.apache.coyote.http2.Http2Exception
    • priorityUpdate Link icon

      public void priorityUpdate(int prioritizedStreamID, Priority p) throws org.apache.coyote.http2.Http2Exception
      Throws:
      org.apache.coyote.http2.Http2Exception
    • onSwallowedUnknownFrame Link icon

      public void onSwallowedUnknownFrame(int streamId, int frameTypeId, int flags, int size) throws IOException
      Throws:
      IOException
    • fill Link icon

      default boolean fill(boolean block, byte[] data) throws IOException
      Throws:
      IOException
    • fill Link icon

      default boolean fill(boolean block, ByteBuffer data, int len) throws IOException
      Throws:
      IOException