I have a Java EE application that generates an Excel file and sends it to the browser (Internet Explorer 8) over HTTPS. The user is presented with the usual IE "Open/Save/Close" dialog. If he clicks on the Open/Save within several seconds, everything works fine. However, if he waits longer (usually > 30 seconds, although varies), when he clicks Open or Save, the dialog just dismisses and nothing happens. I tried different caching headers (e.g., http://support.microsoft.com/kb/272359) and also set the <property name="securePagesWithPragma" value="false"/>
in sun-web.xml according to http://code.google.com/p/google-web-toolkit/issues/detail?id=1172 and neither helps. Here are the response headers:
HTTP/1.0 200 OK
Date: Fri, 10 Jun 2011 09:02:45 GMT
Server: Sun GlassFish Enterprise Server v2.1.1 Patch04
Set-Cookie: SM_UID=[removed]; path=/; domain=[removed]
Set-Cookie: SM_USER=[removed]; path=/; domain=[removed]
X-Powered-By: Servlet/2.5
X-Powered-By: JSF/1.2
Content-disposition: attachment; filename=[removed].xlsm
Cache-Control: private
Content-Type: application/vnd.ms-excel.sheet.macroEnabled.12
Content-Length: 44416
Set-Cookie: JSESSIONID=8c887b2a53924d5484d31821f915.0; Path=/[removed]; Secure
Connection: close
and the error message:
URL: https:[removed].jsf
Content Type: application/vnd.ms-excel.sheet.macroEnabled.12
Headers size (bytes): 2656
Data size (bytes): 8192
Total size (bytes): 10848
Transferred data size (bytes): 10848
Cached data: No
Error result: 0x800c0007
Error constant: INET_E_DATA_NOT_AVAILABLE
Error description: An Internet connection was established, but the data cannot be retrieved
Thank you for any suggestions!
Update: I have an idea as to what causes the error. The download in question is initiated by a simulated click on a hidden button through JavaScript. I suspect, that because of this some thread is blocked while the Open/Save dialog is displayed and the browser is waiting for user input. Here is what I found through DebugBar for a download that fails:
Request start time: Thu, 16 Jun 2011 19:14:15
Connecting time: 177 ms
Headers exchange time: 64 ms
Data transmission time: **72849 ms**
I also have a similar page where a download is initiated manually with user clicking on a button. In this case the download works fine:
Request start time: Thu, 16 Jun 2011 19:18:57
Connecting time: 4 ms
Headers exchange time: 3384 ms
Data transmission time: **23 ms**
In both cases, I left the Open/Save dialog be displayed for about a minute before clicking on "Open". Notice how in the first case the Data transmission time
is the whole period when the dialog was shown, while in the second case it is several milliseconds. I need to simulate a click in the first case because the file that is downloaded is generated asynchronously (Is it safe to start a new thread in a JSF managed bean?).
User contributions licensed under CC BY-SA 3.0