/ Published in: Java
When downloading a file using SSL, IE throws an exception if the Prgama header is set as no- cache. When we uses Apache Tomcat with security-constraint CONFIDENTIAL if the cache control headers(Cache-Control and Pragma) are not present in the response, Tomcat will add them. This will fail in IE. So we need to manually set the cache control values in the servlet itself
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
response.setContentType(contentType); response.setHeader("Content-Disposition", "Attachment;Filename=\"" + fileName + "\""); response.setHeader("Cache-Control", "private, max-age=5"); response.setHeader("Pragma", ""); response.setContentLength(length);