'Should OutputStream be closed explicit in StreamingResponseBody?
I'm streaming a big external resource using StreamingResponseBody in a spring @RestController.
Question: should the OutputStream of the response body be closed explicit here?
@GetMapping("/{filename}")
public ResponseEntity<StreamingResponseBody> getFile(@PathVariable String filename) {
StreamingResponseBody responseBody = outputStream -> {
resolveExternally(outputStream, response, filename);
//TODO should the stream be closed explicit here?
//outputStream.close();
};
return ResponseEntity.ok(responseBody);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
