response.setHeader in IE
Hi All,
I am trying to develop an web application java, thru which i can download an xml file.
My code is working fine in FireFox. But the same code is not working in IE 6 & 7, the file contents are displaying in the browser itself. I am not getting any download option.
Here is my code
response.setContentType("application/xml");
response.setContentType("application/x-download");
response.setHeader("Content-Disposition", "attachement; filename="+ backupFileName);
OutputStream os = response.getOutputStream();
try
{
File fileToDownload = new File(backupFileName);
FileInputStream fileInputStream = new FileInputStream(fileToDownload);
System.out.println("inputStream is called");
int i = 0;
System.out.println("before writing");
while ((i = fileInputStream.read()) != -1) {
os.write(i);
}
fileInputStream.close();
System.out.println("file is written n closed and redirected is false");
redirected = false;
}
catch (FileNotFoundException fnfe)
{
System.out.println("FileNotFoundExcpetion"+fnfe.getMessage());
}
In the following urlhttp://forum.java.sun.com/thread.jspa?messageID=4284031
I had seen that it is a bug is IE 6. How can I resolve my problem.
can u guys plz help me out to fix this problem.
regards,
krish

