I want to stream a file in a reactive way using spring webflux.
How my endpoint should look like more specific what is the type of the object ?
@GetMapping("/file")
Flux<???> file() {
//Read file content into this ??? thing .
}
I want to stream a file in a reactive way using spring webflux.
How my endpoint should look like more specific what is the type of the object ?
@GetMapping("/file")
Flux<???> file() {
//Read file content into this ??? thing .
}
You can return a Resource
instance like this:
@GetMapping("/file")
Mono<Resource> file() {
//Create a ClassPathResource, for example
}
Note that this supports Byte Range HTTP requests automatically.