- From: Mark Tinderholt <mtinderholt@bankone.com>
- Date: Wed, 27 Dec 2000 14:48:56 -0500 (EST)
- To: <www-jigsaw@w3.org>
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. //////////////////////////////////////////////////////////////////////////// //////////////////////// import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class downloadServlet extends HttpServlet { String filename = ""; public void init(ServletConfig config) throws ServletException { super.init(config); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } 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"); byte[] buffer = new byte[4 * 1024]; FileInputStream in = new FileInputStream(target); while ((size = in.read(buffer, 0, buffer.length)) != -1) { out.write(buf, 0, sizeRead); } in.close(); out.close(); } } //////////////////////////////////////////////////////////////////////////// ////////////////////////
Received on Wednesday, 27 December 2000 15:50:15 UTC