Skip to content

Instantly share code, notes, and snippets.

@julianoBRL
Created February 23, 2022 16:50
Show Gist options
  • Save julianoBRL/49b2aa5cbcccde0f1a1c1ff2ef7ab9eb to your computer and use it in GitHub Desktop.
Save julianoBRL/49b2aa5cbcccde0f1a1c1ff2ef7ab9eb to your computer and use it in GitHub Desktop.
@GetMapping
@SuppressWarnings({ "deprecation" })
private ResponseEntity<StreamingResponseBody> get() throws IOException {
StreamingResponseBody responseBody = response -> {
response.write(("{\"Header\":\"data\",").getBytes());
otherClass(response);
response.write(("}").getBytes());
response.flush();
};
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_STREAM_JSON)
.body(responseBody);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment