mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
2b9b581024
Prior to this commit, MVC function endpoints would allow Server Sent Event responses through `ServerResponse.sse()`. While this covers a common use case for streaming responses, other technologies would benefit from a "low-level", unopinionated streaming support. This commit introduces a new `BodyBuilder.stream()` methods that enables such use cases. Developers are in charge of setting the relevant HTTP response headers beforehand, and then can write to the response as raw `String`, `byte[]` or using complex objects and the configured message converters for serialization. Because each streaming protocol has different message separator semantics, it is also the developers' responsibility to flush buffered content to the network once a message has been fully written. Closes gh-32710