Interface SinkProviderContext
SinkProviders supplied
at creation time.-
Method Summary
Modifier and TypeMethodDescriptionRunnable to execute to close the response.Obtains access to the connection context.default Optional<OutputStream> entityOutputStream(Runnable responsePreparation) Entity output stream supplied by protocols that cannot expose the connection data writer directly to a sink provider.default voidFlushes final response headers while keeping the entity output stream open.default ServerRequestObtains the server request associated with this context.Obtains the server response associated with this context.
-
Method Details
-
serverResponse
ServerResponse serverResponse()Obtains the server response associated with this context.- Returns:
- the server response
-
serverRequest
Obtains the server request associated with this context.- Returns:
- the server response
-
connectionContext
ConnectionContext connectionContext()Obtains access to the connection context.- Returns:
- the connection context
-
entityOutputStream
Entity output stream supplied by protocols that cannot expose the connection data writer directly to a sink provider.An empty result indicates that the sink provider must use the connection data writer. When present, the protocol supplies the fully decorated response entity stream, including response filters and content encoding, and the sink provider is responsible for closing it. The sink provider must write unencoded entity bytes and must not apply these transformations again.
A protocol that supplies an entity stream invokes
responsePreparationexactly once, afterServerResponse.beforeSend(Runnable)listeners and before constructing response filters or content encoding. If response preparation fails, the protocol must not construct or return an entity stream. An implementation that returns an empty result does not invokeresponsePreparation.The sink provider must close the stream before invoking
closeRunnable()so stream wrappers can write their final bytes before the protocol response is committed.- Parameters:
responsePreparation- final response preparation- Returns:
- entity output stream, or an empty optional if the protocol does not provide one
-
flushHeaders
default void flushHeaders()Flushes final response headers while keeping the entity output stream open.Protocols returning a stream from
entityOutputStream(Runnable)must override this method so headers can be sent before the first entity byte. -
closeRunnable
-