I have a Controller which allows users to download a file. The problem is that depending on the params sent to the controller, the controller will zip different folders and send them to the clients, and zipping can take sometimes 2 minutes, time while the user is prompted with an empty browser tab and a loading header.
Is there a way I could show a message to the user until the file is zipped and download really starts? Something like "Please wait, your file is being prepared for download!"
Thank you!
This is not specific to spring mvc - you can do this with any sort of web based action (like servlets or webwork/structs actions).
The request the user sends to perform the download should not be creating the .zip, but queue a task that creates the zip, which then another thread (threads?) can pull off and create those .zip files.
E.g,
Since i m not too familiar with spring mvc, the above might be slightly off (in terms of library names/conventions) but the basic idea is there - queue up the zip file creation as a task (using something like ExecutorService), and then quickly render the view. The view itself then either refreshes (use meta refresh tag), or AJAX poll another controller to see if the task is done. If it is, then redirect to the download url.