In case anyone cares it turns out this is related to compression.  A fix
in mod_setenvif for 2.0.49 and above caused compression to be turned on
for IE.  IE apparently doesn't handle the file name correctly when
compression is involved.  Firefox does though.  Changing Apache to use
compression only on text type responses resolves this.

-----Original Message-----
From: Rob Baily 
Sent: Thursday, June 08, 2006 1:11 PM
To: 'users@tomcat.apache.org'
Subject: Content-Disposition and Filename Attribute Not Working In Some
Apache 2 Versions

Hi, I've found that when we upgraded from Apache 2.0.48 to 2.0.49 or any
other Apache release up to the current 2.0.58 part of the
content-disposition header seems to stop working.  I opened up bug 39749
in the Apache section for this.  I got a response from a person there
who said they were stumped and suggested "I suggest you discuss with the
Tomcat folks which web server behavior influences the generation of that
header field.".

Can anyone help me bridge the gap on this to determine where the issue
is?  I've put my bug information from the other bug here.  I'm willing
to run other tests and things in debug mode if I am told what settings
to use and where to look for results or output.  We can reproduce this
on our development system every time.


Thanks!
Rob Baily
 

/-***********************************-/

 

It appears that somewhere between 2.0.48 and 2.0.58 the setting of the
Content-
Disposition to set the file name for content returned broke.  We are
using 
Tomcat 5.0.28 and modJK 1.2.15.  I have put the example servlet code
below.  
When you run the URL the browser pops up with the file name
"TestServlet.doc" 
instead of "test_file_name.doc".  I don't believe this to be a Tomcat
issue 
since it works with HTTP 2.0.48 and not with HTTP 2.0.58.
 
I ran http://dev.servicebench.com/rbaily/servlet/TestServlet on my
system with 
this test servlet.
 
Please let me know if there is anything I can do to clarify or help.
Thanks!
 
/*
 * Created on Jun 7, 2006
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.servicebench.webside.servlet;
 
import java.io.IOException;
 
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.*;
 
/**
 * @author rbaily
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TestServlet extends HttpServlet {
 
        public void doGet(HttpServletRequest req, HttpServletResponse
res)
        throws ServletException, IOException
        {
               doPost(req, res);
        }
 
        public void doPost(HttpServletRequest req, HttpServletResponse
res)
        throws ServletException, IOException
        {
               res.setContentType( "application/msword" );
               res.setContentLength( 20 );
               // set up file name
               String fileName = "filename=\"test_file_name.doc\"";
System.out.println( "filename=" + fileName );                        
               res.setHeader( "Content-Disposition", "attachment;" + 
fileName );
               res.setHeader( "Expires", "0" );
               res.setHeader( "Cache-Control", "must-revalidate, post-
check=0, pre-check=0" );
               ServletOutputStream output = res.getOutputStream();
System.out.println( "about to write" );                              
               output.print( "012345678900987654321" );
               output.flush();
               output.close();
        }
        
}


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to