Class HttpStreamBase

  • All Implemented Interfaces:
    AutoCloseable
    Direct Known Subclasses:
    Http2Stream, HttpStream

    public class HttpStreamBase
    extends CrtResource
    An base class represents a single Http Request/Response for both HTTP/1.1 and HTTP/2 and wraps the native resources from the aws-c-http library. Can be used to update the Window size, or to abort the stream early in the middle of sending/receiving Http Bodies.
    • Constructor Detail

      • HttpStreamBase

        protected HttpStreamBase​(long ptr)
    • Method Detail

      • canReleaseReferencesImmediately

        protected boolean canReleaseReferencesImmediately()
        Determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources that wait are responsible for calling releaseReferences() manually.
        Specified by:
        canReleaseReferencesImmediately in class CrtResource
        Returns:
        true if this resource releases synchronously, false if this resource performs async shutdown
      • releaseNativeHandle

        protected void releaseNativeHandle()
        Cleans up the stream's associated native handle
        Specified by:
        releaseNativeHandle in class CrtResource
      • incrementWindow

        public void incrementWindow​(int windowSize)
        Opens the Sliding Read/Write Window by the number of bytes passed as an argument for this HttpStream. This function should only be called if the user application previously returned less than the length of the input ByteBuffer from a onResponseBody() call in a HttpStreamResponseHandler, and should be <= to the total number of un-acked bytes.
        Parameters:
        windowSize - How many bytes to increment the sliding window by.
      • activate

        public void activate()
        Activates the client stream.
      • getResponseStatusCode

        public int getResponseStatusCode()
        Retrieves the Http Response Status Code
        Returns:
        The Http Response Status Code