Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 42837 invoked from network); 13 Nov 2000 19:34:22 -0000 Received: from unknown (HELO amsmsx01.gorillapark.com) (212.48.42.102) by locus.apache.org with SMTP; 13 Nov 2000 19:34:22 -0000 Received: from amsmsx02.gorillapark.com ([10.1.2.103]) by amsmsx01.gorillapark.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id WZ6Z7GTR; Mon, 13 Nov 2000 20:33:58 +0100 Received: from europa (europa.moonshake.com [10.1.3.53]) by amsmsx02.gorillapark.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id WTYAPJVF; Mon, 13 Nov 2000 20:33:58 +0100 Message-ID: <008d01c04da9$b4475780$3503010a@moonshake.com> From: "Laurens Pit" To: Subject: downloading Word doc Date: Mon, 13 Nov 2000 20:41:20 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hi, Whenever I download a file using Tomcat (i.e. it uses org.apache.tomcat.servlets.DefaultServlet) it works, except when I try to download a Word document. Then the client side seems to get stuck. This is reproducable on different client machines using different servers (Linux and Sun). Is anyone else experiencing this problem? I have also created a very simple Servlet to download a file. Works fine, except again for Word documents. Downloading Word documents from e.g. www.idrive.com work fine though, so it must be some servers-side thing. Can anyone please help?? package com.nervewireless; import java.io.*; import java.util.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public final class FileDownload extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { String path = "C:\\TEMP\\" + req.getPathInfo().substring(1); System.out.println("PATH: " + path); File f = new File(path); InputStream in = new BufferedInputStream(new FileInputStream(f)); res.setContentType("application/x-www-form-urlencoded"); res.setContentLength((int) f.length()); res.setHeader("Content-disposition","attachement; filename=" + f.getName()); OutputStream out = res.getOutputStream(); int sentsize = 0; int readlen; byte buffer[] = new byte[256]; while ((readlen = in.read(buffer)) != -1 ) { out.write(buffer, 0, readlen); sentsize += readlen; } // Success ! Close streams. out.flush(); out.close(); in.close(); System.out.println("DONE!"); } } Greets, Laurens