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
  • 40,156
  • 8
  • 95
  • 98
Dylan
  • 2,161
  • 2
  • 27
  • 51

1 Answers1

0

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

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98