Have been working on this issue for the past 2 days and nt able to get it resolved. I am having a Servlet which is used to download a file to the client. After a successful download I am removing it from the session since it need not be downloaded again.
The issue is that when I attempt the same with IE7 with default setting IE7 blocks the download and thus displays the information Bar regarding the blocked download. However in reality the code in the servlet is executed without any exception being thrown (Since IE7 has blocked the download), thus making it impossible to track an event that the download is blocked. In turn hence, the bean is getting deleted from session and when the user allows the Download from the info bar, the bean is not there in the session and thus cannot download. The code in my servlet is
File f = new File ("c:/test.txt");
response.setContentType("application/vnd.ms-excel");
//response.setContentType("application/x-download");
response.addHeader("Content-Disposition", "attachment; filename=\"" + getDateString() + "download.csv\" ");
InputStream in = new FileInputStream(f);
BufferedInputStream bufferedFileInputStream = new BufferedInputStream(in);
byte[] buffer = new byte[4096];
int bytesRead = 0;
BufferedOutputStream outs = new BufferedOutputStream(out, 4096);
while ((bytesRead = in.read(buffer)) != -1) {
outs.write(buffer, 0, bytesRead);
outs.flush();
}
P.S. I would not want to change the setting in IE. These need to remain