Interface ContentChannel

    • Method Detail

      • write

        void write​(ByteBuffer buf,
                   CompletionHandler handler)
        Schedules the given ByteBuffer to be written to the content corresponding to this ContentChannel. This call transfers ownership of the given ByteBuffer to this ContentChannel, i.e. no further calls can be made to the buffer. The execution of writes happen in the same order as this method was invoked.
        Parameters:
        buf - The ByteBuffer to schedule for write. No further calls can be made to this buffer.
        handler - The CompletionHandler to call after the write has been executed.
      • close

        void close​(CompletionHandler handler)
        Closes this ContentChannel. After a channel is closed, any further attempt to invoke write(ByteBuffer, CompletionHandler) upon it will cause an IllegalStateException to be thrown. If this channel is already closed then invoking this method has no effect, but CompletionHandler.completed() will still be called. Notice that you MUST call this method, regardless of any exceptions that might have occurred while writing to this ContentChannel. Failure to do so will prevent the Container from ever shutting down.
        Parameters:
        handler - The CompletionHandler to call after the close has been executed.
      • onError

        default void onError​(Throwable error)
        Invoked when an error occurs during processing of request content. Signals that the caller was unable to write all data to this ContentChannel. This method can be invoked at any time after the content channel is created, but it's never invoked after close(CompletionHandler). close(CompletionHandler) will be invoked immediately after this method returning (no intermediate calls to #write(ByteBuffer, CompletionHandler)).