2013-11-25 23 views
2

我目前在Wicket中使用downloadLink以允許用戶下載創建的excel文件,然後在之後刪除。當這是通過SSL IE做給我一個錯誤: 「無法下載wicket上的setCacheDuration DownloadLink

的Internet Explorer無法打開這個網站的請求的站點是不可用或無法找到,請稍後再試。」

這裏: http://support.microsoft.com/kb/323308

從上面的Microsoft支持鏈接做一些閱讀後,現在看來,這是因爲 ,因爲它是通過SSL,我有

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

設置我downloadLink像這樣:

 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); 

我想我對什麼是與此發生混淆。 setCacheDuration是否意味着文件創建後有多長時間,它在刪除之前是否可用?或者這是否意味着文件從宣佈開始起可用多久?

在excelCreator()方法裏面我調用File excelfile = new File(「Access.xls」);然後繼續處理所有的Excel工作並創建電子表格,然後在我調用的方法結尾處輸入: FileOutputStream output = new FileOutputStream(excelfile); workbook.write(輸出); output.close();

將我設置的持續時間從我調用的那一刻開始File excelfile = new File(「ssaUserIDAccess.xls」)?

什麼是我應該用於此場景的最佳持續時間和設置?因爲文件可能會變得很大,如果文件足夠大,可能需要一些時間才能創建。

謝謝!

回答

0

我不記得原因,但我們在SSL/IE上遇到了同樣的問題,我們只需將緩存持續時間設置爲1秒就足夠了。只是它不能是無。另一個我們從未找到的解決方案

auditDownloadlink.setCacheDuration(Duration.ONE_SECOND) 
+0

是的,我也這樣做過,而且這似乎適用於所有的搜索案例。感謝您的驗證! – eaglei22