So in my JAVA controller I have:
response.setContentType("text/csv");
response.setHeader("Content-Disposition", "attachment; filename=\"export.csv\"");
try {
OutputStream outputStream = response.getOutputStream();
String outputResult = "xxxx, yyyy, zzzz, aaaa, bbbb, ccccc, dddd, eeee, ffff, gggg\n";
outputStream.write(outputResult.getBytes());
outputStream.flush();
outputStream.close();
} catch (Exception e) {
System.out.println(e.toString());
}
Here is the inspect element network tab:
Under the response tab I see the csv text just like it should display.