Class ResponseHandlerHelper
java.lang.Object
software.amazon.awssdk.http.crt.internal.response.ResponseHandlerHelper
This is the helper class that contains common logic shared between
CrtResponseAdapter and
InputStreamAdaptingHttpStreamResponseHandler.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCancel and close the stream, forcing the underlying connection to shut down rather than be returned to the connection pool.voidincrementWindow(int windowSize) voidonAcquireStream(software.amazon.awssdk.crt.http.HttpStreamBase stream) Set the stream reference and activate it as soon as it is acquired from the pool.voidonResponseHeaders(software.amazon.awssdk.crt.http.HttpStreamBase stream, int responseStatusCode, int headerType, software.amazon.awssdk.crt.http.HttpHeader[] nextHeaders) voidRelease the connection back to the pool so that it may be reused.
-
Constructor Details
-
ResponseHandlerHelper
-
-
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()orclose(). Calling it here ensures this is done.activate()is idempotent per the CRT contract — safe to call even ifHttp1StreamManagerhas 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()beforecancel()to ensure the CRT native layer will deliveronResponseComplete. This is critical forHttp1StreamManagerto release the connection slot back to the pool.activate()is idempotent — calling it on an already-activated stream is safe.
-