|
Date: Thu, 20 Mar 2003 08:53:16 -0600 From: Todd Bryant <tbryant@xxxxxxxxxxxxxxxxxxxxxxx> [ Add to Address Book | Block Address | Report as Spam ] To: 'larryhytail@xxxxxxxxx' <larryhytail@xxxxxxxxx> Subject: RE: Servlet and text/plain Hi Larry, we are having problems with our DNS, so I cannot post to the list as it thinks it is coming from another address than I signed up with. Anyway, the answer to your problem is to set the Content-Disposition header. Here is an example: <% response.setHeader("Content-Disposition", "attachment"); %> This is in its simplest form. You can also specify the name of the file you want the o/s to use by default for the saved file and provide the file size, among other things. I believe the file size just allows windows to calculate the download time remaining for very large files. Example: <% response.setHeader("Content-Disposition", "attachment; filename=myFile.txt; size=1234"); %> Here is the rfc on the content-disposition header http://www.mhonarc.org/~ehood/MIME/rfc2183.txt If you would be so kind, could you post this to the list for others who may find this information useful? Thanks. Todd Bryant, SCJP Programmer/Analyst University of Nebraska Foundation 402-472-5222 ext.#223 -----Original Message----- From: Larry [mailto:larryhytail@xxxxxxxxx] Sent: Wednesday, March 19, 2003 10:26 AM To: java400-l@xxxxxxxxxxxx Subject: Servlet and text/plain Here's what I think should be a simple question, but I could not find the answer. I have a servlet that generates dynamic content in text/plain format that the end user really does not want to display in his/her browser, but really wants to accept it as a download file. If you click on my link to the servlet, currently it builds the data and displays it in text in the browser. Of course the user could right click and do "save file as" to stream it directly to a file on his/her hard drive, but that is not elegant. How do I make the servlet automatically bring up the save file dialog? Thanks, Larry _______________________________________________ No banners. No pop-ups. No kidding. Introducing My Way - http://www.myway.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.