0

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: enter image description here

Under the response tab I see the csv text just like it should display.

Julian Reschke
  • 37,619
  • 8
  • 86
  • 92
Dylan
  • 1,943
  • 1
  • 24
  • 41

1 Answers1

0

It seems you're trying to use Content-Disposition with content requested using XMLHttpRequest. That doesn't work.

Julian Reschke
  • 37,619
  • 8
  • 86
  • 92