Package io.servicetalk.http.api
Class StreamingHttpResponses
java.lang.Object
io.servicetalk.http.api.StreamingHttpResponses
Factory methods for creating
StreamingHttpResponse
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic StreamingHttpResponse
newResponse
(HttpResponseStatus status, HttpProtocolVersion version, HttpHeaders headers, BufferAllocator allocator, HttpHeadersFactory headersFactory) Create a new instance using HTTP 1.1 with empty payload body.static StreamingHttpResponse
newTransportResponse
(HttpResponseStatus status, HttpProtocolVersion version, HttpHeaders headers, BufferAllocator allocator, Publisher<Object> messageBody, boolean requireTrailerHeader, HttpHeadersFactory headersFactory) Creates a newStreamingHttpResponse
which is read from the transport.
-
Method Details
-
newResponse
public static StreamingHttpResponse newResponse(HttpResponseStatus status, HttpProtocolVersion version, HttpHeaders headers, BufferAllocator allocator, HttpHeadersFactory headersFactory) Create a new instance using HTTP 1.1 with empty payload body.- Parameters:
status
- theHttpResponseStatus
of the response.version
- theHttpProtocolVersion
of the response.headers
- theHttpHeaders
of the response.allocator
- the allocator used for serialization purposes if necessary.headersFactory
-HttpHeadersFactory
to use.- Returns:
- a new
StreamingHttpResponse
.
-
newTransportResponse
public static StreamingHttpResponse newTransportResponse(HttpResponseStatus status, HttpProtocolVersion version, HttpHeaders headers, BufferAllocator allocator, Publisher<Object> messageBody, boolean requireTrailerHeader, HttpHeadersFactory headersFactory) Creates a newStreamingHttpResponse
which is read from the transport. If the response contains trailers then the passedpayload
Publisher
should also emitHttpHeaders
before completion.- Parameters:
status
- theHttpResponseStatus
of the response.version
- theHttpProtocolVersion
of the response.headers
- theHttpHeaders
of the response.allocator
- the allocator used for serialization purposes if necessary.messageBody
- aPublisher
for payload that optionally emitsHttpHeaders
if the response contains trailers.requireTrailerHeader
-true
if Trailer header is required to accept trailers.false
assumes trailers may be present if other criteria allows.headersFactory
-HttpHeadersFactory
to use.- Returns:
- a new
StreamingHttpResponse
.
-