org.apache.coyote.http2

## Class StreamStateMachine

- java.lang.Object
- - org.apache.coyote.http2.StreamStateMachine

-     public class StreamStateMachine
      extends Object

  See state diagram in RFC 7540.
  The following additions are supported by this state machine:
  - differentiate between closed (normal) and closed caused by reset

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StreamStateMachine(String connectionId, String streamId)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canRead()`
    `boolean` | `canWrite()`
    `void` | `checkFrameType(FrameType frameType)`
    `void` | `closeIfIdle()`
    `boolean` | `isActive()`
    `boolean` | `isClosedFinal()`
    `boolean` | `isFrameTypePermitted(FrameType frameType)`
    `void` | `receivedEndOfStream()`
    `void` | `receivedPushPromise()`
    `void` | `receivedStartOfHeaders()`
    `void` | `sendReset()` Marks the stream as reset.
    `void` | `sentEndOfStream()`
    `void` | `sentPushPromise()`
    `void` | `sentStartOfHeaders()`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### StreamStateMachine

          public StreamStateMachine(String connectionId,
                            String streamId)

  - ### Method Detail

    - #### sentPushPromise

          public void sentPushPromise()

    - #### receivedPushPromise

          public void receivedPushPromise()

    - #### sentStartOfHeaders

          public void sentStartOfHeaders()

    - #### receivedStartOfHeaders

          public void receivedStartOfHeaders()

    - #### sentEndOfStream

          public void sentEndOfStream()

    - #### receivedEndOfStream

          public void receivedEndOfStream()

    - #### sendReset

          public void sendReset()

      Marks the stream as reset. This method will not change the stream state if:
      - The stream is already reset
      - The stream is already closed
      Throws:
        `IllegalStateException` - If the stream is in a state that does not permit resets

    - #### checkFrameType

          public void checkFrameType(FrameType frameType)
                              throws Http2Exception

      Throws:
        `Http2Exception`

    - #### isFrameTypePermitted

          public boolean isFrameTypePermitted(FrameType frameType)

    - #### isActive

          public boolean isActive()

    - #### canRead

          public boolean canRead()

    - #### canWrite

          public boolean canWrite()

    - #### isClosedFinal

          public boolean isClosedFinal()

    - #### closeIfIdle

          public void closeIfIdle()

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.