I will need to perform a massive download of files from my Web Application.
It is obviously expected to be a long-running action (it\'ll be used once-per-year[-p
For large content that won't fit in memory at once, stream the content from the database to the response.
This kind of thing is actually pretty simple. You don't need AJAX or websockets, it's possible to stream large file downloads through a simple link that the user clicks on. And modern browsers have decent download managers with their own progress bars - why reinvent the wheel?
If writing a servlet from scratch for this, get access to the database BLOB, getting its input stream and copy content through to the HTTP response output stream. If you have Apache Commons IO library, you can use IOUtils.copy(), otherwise you can do this yourself.
Creating a ZIP file on the fly can be done with a ZipOutputStream. Create one of these over the response output stream (from the servlet or whatever your framework gives you), then get each BLOB from the database, using putNextEntry()
first and then streaming each BLOB as described before.
Potential Pitfalls/Issues:
ZipOutputStream
if this is a problem.