Re: how to download file (example)
Hello, Do you want to use the Struts DownloadAction? If so, have a look here: http://wiki.apache.org/struts/StrutsFileDownload Even if you don't want to use it, you may find the example helpful, along with the source for DownloadAction, to help you along. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, May 11, 2005 2:30 pm, Grzegorz Stasica said: hi, I'm looking for links/examples how to download file in struts action. In action I have OutputStream but what header should I send and the most important how the stram should be send to browser - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to download file (example)
True... I would however be very willing to bet you can lift the DownloadAction class from 1.2.6 and drop it in 1.2.4 without any problem... As a matter of fact, although I'm not 100% certain, I think the sample app I wrote that you can grab off the Wiki is in fact using 1.2.4... heck, there's a chance it's using 1.1! :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Wed, May 11, 2005 3:30 pm, Grzegorz Stasica said: Frank W. Zammetti wrote: Hello, Do you want to use the Struts DownloadAction? If so, have a look here: http://wiki.apache.org/struts/StrutsFileDownload Even if you don't want to use it, you may find the example helpful, along with the source for DownloadAction, to help you along. Unfortunatelly I am running struts 1.2.4. DownloadActioni will be available in 1.2.6 version which at this moment is in beta phase - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to download file (example)
This is a little example : response.setHeader(Content-Disposition, attachment; filename=\ + part.getFileName() + \); response.setContentType(part.getContentType()); InputStream instream = part.getInputStream(); ServletOutputStream outstream = response.getOutputStream(); int b = 0; while (b != -1) { b = instream.read(); outstream.write(b); } instream.close(); outstream.close(); WHERE part.getFileName() sustitute by the Filename of the File, part.getContentType() sustitute the ContentType of the File part.getInputStream(); sustitute the Stream Data of the File. That's all! - Original Message - From: Grzegorz Stasica [EMAIL PROTECTED] To: user@struts.apache.org Sent: Wednesday, May 11, 2005 9:30 PM Subject: Re: how to download file (example) Frank W. Zammetti wrote: Hello, Do you want to use the Struts DownloadAction? If so, have a look here: http://wiki.apache.org/struts/StrutsFileDownload Even if you don't want to use it, you may find the example helpful, along with the source for DownloadAction, to help you along. Unfortunatelly I am running struts 1.2.4. DownloadActioni will be available in 1.2.6 version which at this moment is in beta phase - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]