org.apache.coyote.http2

## Class Stream

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

-     public class Stream
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected StreamStateMachine` | `state`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Stream(Integer identifier, Http2UpgradeHandler handler)`
    `Stream(Integer identifier, Http2UpgradeHandler handler, Request coyoteRequest)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `decrementWindowSize(int decrement)`
    `protected void` | `doNotifyAll()` Deprecated.
    `void` | `emitHeader(String name, String value)` Pass a single header to the recipient.
    `protected String` | `getConnectionId()`
    `int` | `getIdAsInt()`
    `Integer` | `getIdentifier()`
    `protected int` | `getWeight()`
    `protected long` | `getWindowSize()`
    `protected void` | `incrementWindowSize(int windowSizeIncrement)` Increment window size.
    `void` | `setHeaderException(StreamException streamException)` Inform the recipient of the headers that a stream error needs to be triggered using the given message when `validateHeaders()` is called.
    `protected void` | `setWindowSize(long windowSize)`
    `void` | `validateHeaders()` Are the headers pass to the recipient so far valid?

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

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

- - ### Field Detail

    - #### state

          protected final StreamStateMachine state

  - ### Constructor Detail

    - #### Stream

          public Stream(Integer identifier,
                Http2UpgradeHandler handler)

    - #### Stream

          public Stream(Integer identifier,
                Http2UpgradeHandler handler,
                Request coyoteRequest)

  - ### Method Detail

    - #### incrementWindowSize

          protected final void incrementWindowSize(int windowSizeIncrement)
                                            throws Http2Exception

      Increment window size.
      Parameters:
        `windowSizeIncrement` - The amount by which the window size should be increased
      Throws:
        `Http2Exception` - If the window size is now higher than the maximum allowed

    - #### doNotifyAll

          @Deprecated
          protected void doNotifyAll()

      Deprecated.

    - #### emitHeader

          public final void emitHeader(String name,
                        String value)
                                throws HpackException

      Pass a single header to the recipient.
      Parameters:
        `name` - Header name
        `value` - Header value
      Throws:
        `HpackException` - If a header is received that is not compliant with the HTTP/2 specification

    - #### setHeaderException

          public void setHeaderException(StreamException streamException)

      Inform the recipient of the headers that a stream error needs to be triggered using the given message when `validateHeaders()` is called. This is used when the Parser becomes aware of an error that is not visible to the recipient.
      Parameters:
        `streamException` - The exception to use when resetting the stream

    - #### validateHeaders

          public void validateHeaders()
                               throws StreamException

      Are the headers pass to the recipient so far valid? The decoder needs to process all the headers to maintain state even if there is a problem. In addition, it is easy for the the intended recipient to track if the complete set of headers is valid since to do that state needs to be maintained between the parsing of the initial headers and the parsing of any trailer headers. The recipient is the best place to maintain that state.
      Throws:
        `StreamException` - If the headers received to date are not valid

    - #### getConnectionId

          protected final String getConnectionId()

    - #### getWeight

          protected final int getWeight()

    - #### getIdentifier

          public Integer getIdentifier()

    - #### getIdAsInt

          public int getIdAsInt()

    - #### setWindowSize

          protected void setWindowSize(long windowSize)

    - #### getWindowSize

          protected long getWindowSize()

    - #### decrementWindowSize

          protected void decrementWindowSize(int decrement)

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