HeaderSink (Apache Tomcat 8.5.43 API Documentation)

org.apache.coyote.http2

## Class HeaderSink

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

-     public class HeaderSink
      extends java.lang.Object

  Purpose of this class is to silently swallow any headers. It is used once the connection close process has started if headers for new streams are received.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HeaderSink()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `emitHeader(java.lang.String name, java.lang.String value)` Pass a single header to the recipient.
    `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.
    `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`

- - ### Constructor Detail

    - #### HeaderSink

          public HeaderSink()

  - ### Method Detail

    - #### emitHeader

          public void emitHeader(java.lang.String name,
                        java.lang.String value)

      Pass a single header to the recipient.
      Parameters:
        `name` - Header name
        `value` - Header value

    - #### 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

    - #### 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

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