Interface HttpRequestBodyStream


  • public interface HttpRequestBodyStream
    Interface that Native code knows how to call when handling Http Request bodies
    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default long getLength()
      Called from native when the processing needs to know the length of the stream.
      default boolean resetPosition()
      Called from native when the processing needs the stream to rewind itself back to its beginning.
      default boolean sendRequestBody​(java.nio.ByteBuffer bodyBytesOut)
      Called from Native when the Http Request has a Body (Eg PUT/POST requests).
    • Method Detail

      • sendRequestBody

        default boolean sendRequestBody​(java.nio.ByteBuffer bodyBytesOut)
        Called from Native when the Http Request has a Body (Eg PUT/POST requests). Note that this function may be called many times as Native sends the Request Body. Do NOT keep a reference to this ByteBuffer past the lifetime of this function call. The CommonRuntime reserves the right to use DirectByteBuffers pointing to memory that only lives as long as the function call.
        Parameters:
        bodyBytesOut - The Buffer to write the Request Body Bytes to.
        Returns:
        True if Request body is complete, false otherwise.
      • resetPosition

        default boolean resetPosition()
        Called from native when the processing needs the stream to rewind itself back to its beginning. If the stream does not support rewinding or the rewind fails, false should be returned Signing requires a rewindable stream, but basic http does not.
        Returns:
        True if the stream was successfully rewound, false otherwise.
      • getLength

        default long getLength()
        Called from native when the processing needs to know the length of the stream. If the stream does not know/support length, 0 should be returned. Signing requires a rewindable stream, but basic http does not.
        Returns:
        Stream length, or 0 if unknown stream or length is unsupported