tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Viers <>
Subject Re: Writing temporary file & downloading it? [SOLVED]
Date Sat, 18 Oct 2003 19:50:26 GMT
I had to do it a little differently (this is for a .zip file so I had to 
use the OutputStream) but you definitely got me on the right track.

Thanks for all the help!


Shapira, Yoav wrote:

>>The directory it returns is C:\tomcat\work\Standalone\localhost\gss and
>>I can write test.txt there fine.  If I try to make a hyper link to
>>http://localhost:8080/gss/test.txt, though, Tomcat returns 404.  Do I
>>have to do something special to tell Tomcat to serve the file?
>You can only http hyperlink to resources under your webapp root.  Your
>temp file is not under your webapp root.  So you need a servlet that
>will read your temp file, and write it out to the response.  Something
>BufferedReader bin = new BufferedReader(new FileReader(myFile));
>PrintWriter out = response.getWriter();
>String line = null;
>while((line = bin.readLine()) != null) {
>  out.println(line);
>  out.flush();
>Alternative approaches exist.
>Yoav Shapira
>This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message