Package io.servicetalk.http.api
Class StreamingHttpResponses
java.lang.Object
io.servicetalk.http.api.StreamingHttpResponses
Factory methods for creating
StreamingHttpResponses.-
Method Summary
Modifier and TypeMethodDescriptionstatic StreamingHttpResponsenewResponse(HttpResponseStatus status, HttpProtocolVersion version, HttpHeaders headers, BufferAllocator allocator, HttpHeadersFactory headersFactory) Create a new instance using HTTP 1.1 with empty payload body.static StreamingHttpResponsenewTransportResponse(HttpResponseStatus status, HttpProtocolVersion version, HttpHeaders headers, BufferAllocator allocator, Publisher<Object> messageBody, boolean requireTrailerHeader, HttpHeadersFactory headersFactory) Creates a newStreamingHttpResponsewhich 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- theHttpResponseStatusof the response.version- theHttpProtocolVersionof the response.headers- theHttpHeadersof the response.allocator- the allocator used for serialization purposes if necessary.headersFactory-HttpHeadersFactoryto 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 newStreamingHttpResponsewhich is read from the transport. If the response contains trailers then the passedpayloadPublishershould also emitHttpHeadersbefore completion.- Parameters:
status- theHttpResponseStatusof the response.version- theHttpProtocolVersionof the response.headers- theHttpHeadersof the response.allocator- the allocator used for serialization purposes if necessary.messageBody- aPublisherfor payload that optionally emitsHttpHeadersif the response contains trailers.requireTrailerHeader-trueif Trailer header is required to accept trailers.falseassumes trailers may be present if other criteria allows.headersFactory-HttpHeadersFactoryto use.- Returns:
- a new
StreamingHttpResponse.
-