Created
February 23, 2022 16:50
-
-
Save julianoBRL/49b2aa5cbcccde0f1a1c1ff2ef7ab9eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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