tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject RE: File Download - CSV question ****
Date Fri, 26 Oct 2001 15:53:25 GMT

On Fri, 26 Oct 2001, Dmitri Colebatch wrote:

> Date: Fri, 26 Oct 2001 15:10:03 +1000
> From: Dmitri Colebatch <>
> Reply-To:
> To: "''" <>
> Subject: RE: File Download - CSV question    ****
> On Thu, 25 Oct 2001, Evan Swanson wrote:
> > I am using IE5.0 in both situations. The only difference is going from
> > TC3.2 on windows to TC4.0 on HP Unix. I would think that the IE would
> > be making the decision on how to handle the file by the extension name
> > but it is not.
> technically speaking it should (and by the sounds of it is) be looking at
> the mime type.
> > Is MIME type something you can configure on Tomcat?

Yes -- either in Tomcat or in your application web.xml.  These MIME type
settings are used by Tomcat when it serves static resources, or you can
look them up yourself via ServletContext.getMimeType().

For Tomcat 4 (the technique is different on 3.x and I don't recall the
details), you can set MIME types globally by modifying
$TOMCAT_HOME/conf/web.xml.  For all versions of Tomcat, you can define
MIME types in your own web.xml file by adding <mime-mapping> elements.
For example:


is how Tomcat knows what content type to set on HTML pages.

To trigger a download dialog for CSV files (the original question on this
thread), you need to configure a MIME type that your browser doesn't
recognize -- usually "application/octet-stream" will work.  On the other
hand, you can configure things to fire off Excel automatically, as well
(if your browser is set up that way) by saying something like:


(Check the "file types" configuration in your browser to find out what the
correct MIME types should be.)


View raw message