I have an endpoint that should generate a CSV report with a stream. I implemented the endpoint like this:
@GetMapping(value = "/sessions/csv")
public Flux<CsvEntity> getCsv() {
return csvService.exportToCsv();
}
Now I'm getting the response through a stream, but I don't have headers and the data is shown with the field name.
I tried to use StatefulBeanToCsv
of opencsv but for that I need a writer. When I used servlets I could initialize a writer with the response.getOutputStream()
but with webflux I couldn't make it work.
I didn't find any documentation for that. Any help?