Q:

How to use a zip file download in wicket for larger files?

I would like to donload the zip file which is as large as upto 50MB. Currently I am using following IModel Object's getObject method to return the zip file.
IModel fileModel = new AbstractReadOnlyModel() {
public Object getObject() {
   .....
   ZipOutputStream zip = null;
   FileOutputStream fileWriter = null;
   fileWriter = new FileOutputStream(destZipFile);
   zip = new ZipOutputStream(fileWriter);

   /*Add the zip file in the folder*/

   return new File(zipFilePath);
}

following is the download link
reportLink = new DownloadLink(this.getString("id.reportslink"),
                fileModel) {
            private static final long serialVersionUID = 1L;
}

Currently JVM heap size is 1GB and above code will get crashed if there are 20 users concurently downloading the files (Assuming 50MB each file). Can anyone please suggest, what would be best way implement the downloading file so that it will not get crashed even if number of users are upto 100 at a time. 

A:

This suggests that you should flush the output stream after a given amount of data has been send.

