locked
response.setHeader in IE RRS feed

  • Question

  •  

    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  url  http://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

     

    Friday, June 30, 2006 7:27 AM

Answers

  • Per the support engineer team:

    After careful examination of this issue we are of the opinion that this is something to do with JAVA and not with any Microsoft product, since his code is working with Firefox but not with IE. They might have to modify their “JAVA” code to make it compatible with IE 6 or IE 7.

    -brenda (ISV Buddy Team)

    Friday, July 14, 2006 5:35 PM

All replies

  • Per the support engineer team:

    After careful examination of this issue we are of the opinion that this is something to do with JAVA and not with any Microsoft product, since his code is working with Firefox but not with IE. They might have to modify their “JAVA” code to make it compatible with IE 6 or IE 7.

    -brenda (ISV Buddy Team)

    Friday, July 14, 2006 5:35 PM
  • Content Headers are not Java specific. I would like to know how much money every day Microsoft costs the American economy in lost productivity
    Thursday, May 3, 2007 7:09 PM
  • I know it's been a long time, but were you able to figure this out?  I am having an issue where when prompted to download and I say open, it opens in the same window instead of opening a new one.
    Wednesday, March 31, 2010 6:20 PM