0

How can I return and output stream to the user and display a success message to the user? The user would make a request, the back end will do some work and return a byte array that is in memory. There is no file on disk.

Controller would have the following:

response.getOutputStream().write(baos.toByteArray());

I was thinking about using ajax somehow but couldn't figure out how to do so.

Dot Batch
  • 576
  • 4
  • 14

1 Answers1

0

Check out John Culviner's solution: https://stackoverflow.com/a/9970672/14607

http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/

Community
  • 1
  • 1
Mike Kantor
  • 1,280
  • 4
  • 23
  • 42
  • The problem with this is that it doesn't seem to send a custom success message back. It only says if it went good or not. I need the user to upload a file which I check. and send a message back with a summary and return the file back. – Dot Batch Oct 07 '15 at 19:23
  • Maybe your main page could poll the server until the file has been processed. – Mike Kantor Oct 08 '15 at 06:25