Interface InboundHttp2ToHttpAdapter.ImmediateSendDetector

  • Enclosing class:
    InboundHttp2ToHttpAdapter

    private static interface InboundHttp2ToHttpAdapter.ImmediateSendDetector
    Allows messages to be sent up the pipeline before the next phase in the HTTP message flow is detected.
    • Method Detail

      • mustSendImmediately

        boolean mustSendImmediately​(FullHttpMessage msg)
        Determine if the response should be sent immediately, or wait for the end of the stream
        Parameters:
        msg - The response to test
        Returns:
        true if the message should be sent immediately {@code false) if we should wait for the end of the stream
      • copyIfNeeded

        FullHttpMessage copyIfNeeded​(ByteBufAllocator allocator,
                                     FullHttpMessage msg)
        Determine if a copy must be made after an immediate send happens.

        An example of this use case is if a request is received with a 'Expect: 100-continue' header. The message will be sent immediately, and the data will be queued and sent at the end of the stream.

        Parameters:
        allocator - The ByteBufAllocator that can be used to allocate
        msg - The message which has just been sent due to mustSendImmediately(FullHttpMessage)
        Returns:
        A modified copy of the msg or null if a copy is not needed.