- From: Sukumar Chakraborty <sukumarc@interrait.com>
- Date: Mon, 15 Jan 2001 04:34:35 -0500 (EST)
- To: <www-jigsaw@w3.org>
Hi, I am facing a problem while downloading a file by a servlet using IE5. After downloading is finished and the file is saved in my local disk, the hour glass continues in my browser until I press the STOP button, surprisingly the problem is not occuring when I am using Netscape. I am enclosing the function below : /*************************************************************************** **********************/ public class TestDownload extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType( "application/doc" ); // MIME type for pdf doc res.setContentLength(); response.setHeader("Content-disposition", "attachment; filename=" + "table.doc"); String fileURL = "test.doc"; URL url=new URL(fileURL); BufferedInputStream bis = new BufferedInputStream(url.openStream()); BufferedOutputStream bos = new ufferedOutputStream( response.getOutputStream()); byte[] buff = new byte[2048]; int bytesRead; while (-1!=(bytesRead=(bis.read(buff,0,buff.length)))){ bos.write(buff,0,bytesRead); } if (bis!=null){ bis.close(); } if (bos!=null){ bos.close(); } } } /*************************************************************************** ***********************/
Received on Monday, 15 January 2001 04:55:37 UTC