Package ratpack.core.http.client
Interface StreamedResponse
-
- All Superinterfaces:
HttpResponse
- All Known Subinterfaces:
ServerSentEventResponse
public interface StreamedResponse extends HttpResponse
A received response to a http client request with streamed response content.The HTTP status and response headers are available immediately, the response content can be accessed by subscribing to the
Publisher
returned fromgetBody()
or can be directly streamed as a server response usingforwardTo(Response, Action)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
forwardTo(Response response)
Stream this received response out to the given server response.void
forwardTo(Response response, Action<? super MutableHeaders> headerMutator)
Stream this received response out to the given server response.TransformablePublisher<io.netty.buffer.ByteBuf>
getBody()
-
Methods inherited from interface ratpack.core.http.client.HttpResponse
getHeaders, getStatus, getStatusCode
-
-
-
-
Method Detail
-
getBody
TransformablePublisher<io.netty.buffer.ByteBuf> getBody()
- Returns:
- a
Publisher
of response content chunks.
-
forwardTo
void forwardTo(Response response)
Stream this received response out to the given server response.- Parameters:
response
- the server response to stream to- See Also:
forwardTo(Response, Action)
-
forwardTo
void forwardTo(Response response, Action<? super MutableHeaders> headerMutator)
Stream this received response out to the given server response.The HTTP status and response headers of this response will be copied to the given server response. If this response has a
content-length
http header it will be excluded from the copy as all responses will be streamed with atransfer-encoding
ofchunked
. Outgoing response headers can be added and modified with the given header mutatingAction
.This method will stream the response content chunks unmodified to the given server response using the publisher returned from
getBody()
.- Parameters:
response
- the server response to stream toheaderMutator
- an action that will act on the outgoing response headers
-
-