- From: Roland Mainz <Roland.Mainz@informatik.med.uni-giessen.de>
- Date: Wed, 24 Jan 2001 11:47:47 +0100
- To: www-jigsaw@w3.org
Mark Tinderholt wrote:
>
> Hi, I am having trouble with my file download servlet cooperating nicely
> with internet explorer. You see when the this is called upon a certain file
> in Netscape Browser, a Save As dialog appears with the correct filename of
> the choosen file BUT Internet Explorer has the fileName of the servlet
> CLASS! This is unacceptable. Does IE use a different syntax or even a
> different way of reading the HTTP header?! Any assistance is most
> appreciated.
[snip]
> public void doPost(HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException, IOException {
>
> int size = 0;
>
> filename = request.getParameter("fn");
> File target = new File(filename);
>
> OutputStream out = response.getOutputStream();
> response.setContentType("application/octet-stream");
> response.setHeader("Content-Disposition", "attachment; filename=" +
> originalFileName + ";");
> response.setHeader("Cache-Control", "no-cache");
1. Read the documentation of ServletResponse.getOutputStream() - _first_
call setContentType(), then obtain output writer/stream - otherwise
incorrect results my occur (setContentType() may modify the type of
Writer class returned...)
2. Try to set the filename in the contenttype header - the "attachment;
filename" method normally appiles to emails only (or not ??)...
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) Roland.Mainz@informatik.med.uni-giessen.de
\__\/\/__/ gisburn@informatik.med.uni-giessen.de
/O /==\ O\ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
(;O/ \/ \O;) TEL +49 641 99-41370 FAX +49 641 99-41359
Received on Wednesday, 24 January 2001 05:47:57 UTC