@Incubating
@RecordType
class HttpStreamResult
extends Object
Streaming response wrapper for HttpBuilder's streamAsync family.
Unlike HttpResult, this does not buffer the response body. The body
is exposed as a Flow.Publisher of byte chunks that can be consumed
incrementally — typically via for await (chunk in result.bodyAsPublisher())
once the groovy-concurrent-java FlowPublisherAdapter is on
the classpath.
| Modifiers | Name | Description |
|---|---|---|
static class |
HttpStreamResult.LinePublisher |
|
static class |
HttpStreamResult.MappedPublisher |
|
static class |
HttpStreamResult.MappingSubscriber |
| Type | Name and description |
|---|---|
HttpHeaders |
headers |
HttpResponse<Flow.Publisher<List<ByteBuffer>>> |
raw |
int |
statusStreaming response wrapper for HttpBuilder's streamAsync family. |
| Constructor and description |
|---|
HttpStreamResult(Publisher<List<ByteBuffer>> response) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
Flow.Publisher<String> |
bodyAsLinePublisher(Charset charset)Returns the response body as a publisher of newline-terminated strings. |
|
Flow.Publisher<List<ByteBuffer>> |
bodyAsPublisher()Returns the response body as a publisher of List<ByteBuffer>
chunks, exactly as JDK HttpResponse.BodyHandlers.ofPublisher()
provides it. |
|
Flow.Publisher<String> |
bodyAsTextPublisher(Charset charset)Returns the response body as a publisher of decoded strings, one per arriving chunk. |
Streaming response wrapper for HttpBuilder's streamAsync family.
Unlike HttpResult, this does not buffer the response body. The body
is exposed as a Flow.Publisher of byte chunks that can be consumed
incrementally — typically via for await (chunk in result.bodyAsPublisher())
once the groovy-concurrent-java FlowPublisherAdapter is on
the classpath.
Returns the response body as a publisher of newline-terminated strings. Useful for line-oriented streaming protocols (NDJSON, SSE without event framing, log tails). Trailing partial lines are emitted on completion.
charset - the charset to decode bytes with (defaults to UTF-8) Returns the response body as a publisher of List<ByteBuffer>
chunks, exactly as JDK HttpResponse.BodyHandlers.ofPublisher()
provides it.
Returns the response body as a publisher of decoded strings, one per arriving chunk. Each emitted string corresponds to one upstream HTTP frame (often a complete SSE event or a JSON line, but boundaries are not guaranteed). Use bodyAsLinePublisher for line-aligned delivery.
charset - the charset to decode bytes with (defaults to UTF-8)Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.