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 as soon as it is acquired from the pool, so that closeConnection can cancel it even if onResponseHeaders has not yet fired (e.g.
    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 as soon as it is acquired from the pool, so that closeConnection can cancel it even if onResponseHeaders has not yet fired (e.g. the server is unresponsive).
    • 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. cancel() must be invoked before close() per the CRT contract.