tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "CPC Livelink Admin" <>
Subject RE: downloading Word doc
Date Mon, 13 Nov 2000 19:51:56 GMT

Is it just word, or excel, powerpoint, etc too?  Could this be the Frontpage
extentions/Office SP1a bug rearing it's ugly head?  This bug causes issues
when Word tries to download the file, but it doesn't share the same browser
cookies/sessions and so it gets sent to a login page or something else
instead of the file it wants.

-----Original Message-----
From: Laurens Pit []
Sent: Monday, November 13, 2000 02:41 PM
Subject: downloading Word doc


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. work fine though, so it must be some servers-side thing. Can
anyone please help??

package com.nervewireless;

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.setContentLength((int) f.length());
        res.setHeader("Content-disposition","attachement; filename=" +
        OutputStream out = res.getOutputStream();

        int  sentsize = 0;
        int  readlen;
        byte buffer[] = new byte[256];

        while ((readlen = != -1 ) {
          out.write(buffer, 0, readlen);
          sentsize += readlen;

        // Success ! Close streams.



View raw message