我正在StreamingResponseBody
的春季使用@RestController
流式传输大量外部资源。
问题:响应正文的OutputStream
是否应在此处显式关闭?
@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);
}