setCacheDuration on Wicket DownloadLink

eaglei22

I am currently using a downloadLink in Wicket to allow a user to download a created excel file, and then to be deleted afterwards. When this is done over SSL IE gives me an error: "Unable to download.

Internet Explorer was unable to open this site. The requested site is either unavailable or cannot be found. Please try again later. "

here: http://support.microsoft.com/kb/323308

after doing some reading from the above microsoft support link, it seems it is because because it's over SSL, and I have

  response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store");

I set my downloadLink like so:

     private void setupDownloadLink()
{
   IModel excelFileModel = new AbstractReadOnlyModel()
   {
          public Object getObject() 
          { 
            return excelCreator();
          }
       };

     auditDownloadlink = new DownloadLink("auditDownloadlink", excelFileModel);
     auditDownloadlink.setOutputMarkupPlaceholderTag(true);
     auditDownloadlink.setDeleteAfterDownload(true);
     auditDownloadlink.setCacheDuration(Duration.NONE);
     auditDownloadlink.setVisible(false);

     findUserForm.add(auditDownloadlink);

  }

      However, it seems to work if I do:     auditDownloadlink.setCacheDuration(Duration.Minute); 

I guess I am confused on what is happening with this. Does the setCacheDuration mean how long after the file is created, it will be available for before it is deleted? Or does this mean how long in total the file will be available for from the start of declaring it?

inside the excelCreator() method I call File excelfile = new File("Access.xls"); and then go ahead and process all of the excel work and create the spreadsheet, then at the end of the method I call: FileOutputStream output = new FileOutputStream(excelfile); workbook.write(output); output.close();

Will the duration time I set start from the moment I call File excelfile = new File("ssaUserIDAccess.xls")?

What is the best duration and setup I should use for this scenario? Because the files can get quit huge, and can take some time to create if it is big enough.

Thanks!

Martin Strejc

I do not remember the reason, but we had the same problem on SSL/IE and we just set the cache duration to 1 second that is enough. Just it cannot be NONE. Another solution we've never found.

auditDownloadlink.setCacheDuration(Duration.ONE_SECOND)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related