If you aren't using Spring, you can achieve the same result using a standard HttpServlet .
This example shows how to create a ZIP file on the fly from a list of strings (as dummy files).
Always wrap your streams in a BufferedOutputStream to improve I/O performance during the download process. ⚠️ Common Pitfalls
This ensures the ZIP is written directly to the HTTP response stream, which is memory-efficient for large files.