Class ResponseHandlerHelper

java.lang.Object
software.amazon.awssdk.http.crt.internal.response.ResponseHandlerHelper

@SdkInternalApi public class ResponseHandlerHelper extends Object
This is the helper class that contains common logic shared between CrtResponseAdapter and InputStreamAdaptingHttpStreamResponseHandler.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cancel and close the stream, forcing the underlying connection to shut down rather than be returned to the connection pool.
    void
    incrementWindow(int windowSize)
     
    void
    onAcquireStream(software.amazon.awssdk.crt.http.HttpStreamBase stream)
    Set the stream reference and activate it as soon as it is acquired from the pool.
    void
    onResponseHeaders(software.amazon.awssdk.crt.http.HttpStreamBase stream, int responseStatusCode, int headerType, software.amazon.awssdk.crt.http.HttpHeader[] nextHeaders)
     
    void
    Release the connection back to the pool so that it may be reused.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • onAcquireStream

      public void onAcquireStream(software.amazon.awssdk.crt.http.HttpStreamBase stream)
      Set the stream reference and activate it as soon as it is acquired from the pool.

      Activate must be called before any other methods on the stream including cancel() or close(). Calling it here ensures this is done.

      activate() is idempotent per the CRT contract — safe to call even if Http1StreamManager has already activated the stream.

    • onResponseHeaders

      public void onResponseHeaders(software.amazon.awssdk.crt.http.HttpStreamBase stream, int responseStatusCode, int headerType, software.amazon.awssdk.crt.http.HttpHeader[] nextHeaders)
    • incrementWindow

      public void incrementWindow(int windowSize)
    • releaseConnection

      public void releaseConnection()
      Release the connection back to the pool so that it may be reused. This should be called when the request completes successfully and the response has been fully consumed.
    • closeConnection

      public void closeConnection()
      Cancel and close the stream, forcing the underlying connection to shut down rather than be returned to the connection pool. This should be called on error paths or when the stream is aborted before the response is fully consumed.

      Calls activate() before cancel() to ensure the CRT native layer will deliver onResponseComplete. This is critical for Http1StreamManager to release the connection slot back to the pool. activate() is idempotent — calling it on an already-activated stream is safe.