com.twitter.finatra.http.response
Construct a StreamingResponse from an AsyncStream
and a toBuf
Construct a StreamingResponse from an AsyncStream
and a toBuf
Function for converting messages to a binary Buf
representation.
Status code of the generated response.
Headers for the generated response.
Optional first chunk of the response body. Note that a separator will not be
added between the prefix and the elements of the AsyncStream
.
Separator to be interleaved between each result of the AsyncStream
.
Suffix to append to the end of the AsyncStream
. Note that a separator will
not be included between the last stream chunk and the suffix.
A hook for cleaning up resources after completion of the rendering process. Note that this will be called regardless of whether rendering the body is successful.
The grace period provided to the closeable in closeOnFinish
The data that will represent the body of the response.
Construct a StreamingResponse from an AsyncStream
and an AsyncStream[T] => AsyncStream[(U, Buf)]
Construct a StreamingResponse from an AsyncStream
and an AsyncStream[T] => AsyncStream[(U, Buf)]
A StreamingResponse is useful for streaming data back to the client in chunks: data will
be rendered to the client as it resolves from the AsyncStream
while also utilizing the
back-pressure mechanisms provide by the underlying transport, preventing unnecessary resource
consumption for properly constructed AsyncStream
s.
The incoming type.
An auxiliary type passed to onWrite which may be helpful when executing the onWrite callback.
Function which converts AsyncStream[T] to AsyncStream[(U, Buf)]
Status code of the generated response.
Headers for the generated response.
A hook to clean up resources upon disconnection, either normally or exceptionally.
The grace period provided to close the Response.writer.
The data that will represent the body of the response.