I had exactly this problem -- it also reversed itself in that some
browsers would work fine with the save but not the open. When I changed
the content-disposition to inline it worked, but obviously, things would
now open if they could and save otherwise.

Clayton

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]] On Behalf Of Myo Myint Oo
Sent: 30 September 2002 07:29
To: [EMAIL PROTECTED]
Subject: File download dialog box pop up twice


Hello,

I am facing a problem dowloading a file from servlet. Everything work
well, except that the dialog box (asking saving or open file) popup
twice when I choose to open file option. Saving is ok, the dialog box
open only 1. Any body have the idea to suggest me?

Thanks

Myo


file = new File(CDRpath);
                if ( ( content_type = request.getParameter
("CONTENT_TYPE")) == null)
                        content_type = "application/octect-stream";
                response.setContentType (content_type);
                response.setHeader ("Content-Disposition", "attachment;
filename=\"" + file.getName () + "\"");
                ServletOutputStream out = response.getOutputStream ();

       ByteArrayOutputStream outStream = new ByteArrayOutputStream();

                RandomAccessFile raf = new RandomAccessFile (CDRpath,
"r");
                byte b[] = new byte[4096];
                int len;
                while ((len = raf.read(b)) > -1)
                        out.write (b, 0, len);

                out.close ();
                raf.close ();

========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found
at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to