struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@gmail.com>
Subject Re: how to download a file
Date Thu, 22 Jun 2006 14:33:12 GMT
http://wiki.apache.org/struts/StrutsFileDownload

Niall

On 6/22/06, Ed Griebel <edgriebel@gmail.com> wrote:
> Take a look at org.apache.struts.actions.DownloadAction, I created an
> action that extended it (and implemented the internal StreamInfo) and
> was able to create an action that downloaded a PDF doc in less than an
> hour.
>
> For creating a new file to stream, one approach is to create the temp
> file using (untested, of course):
>  File dir = new
> File(request.getSession().getServletContext().getRealPath("."));
>  File tmp = File.createTempFile("web",null,dir);
>  tmp.deleteOnExit();
> You may not have rights to write to the web server's root directory,
> you might be able to get away with "File tmp =
> File.createTempFile("web", null);"
> Store the data to this temp file, passing the file as a stream in the
> aformentioned StreamInfo object. To eliminate creating the temp file,
> stream the file directly without having an intermediate file.
>
> -ed
>
> On 6/22/06, Kavita Mehta <kavita.mehta@hsc.com> wrote:
> > my requirement is to save some lines on the server in a file and then
> > download it to the client's PC .  can anybdy suggest how to go abt it ....
> > thanks
> > Kavita
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message