You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam B <cr...@gmail.com> on 2006/01/21 01:01:27 UTC

Download files via a Struts action?

My goal is to create a web page in my Stuts webapp with links to download
any file in the Tomcat/logs directory.  I am able to do this using a my
getFile.do action:

<a href="getFile.do?file=catalina.out">catalina.out</a>
<a href="getFile.do?file=stdout.log">stdout.log</a>

The problem is that when the user clicks this link the browser wants to
download the file as "getFile.do" because that's what the href says the file
is called.  I really need something closer to:

<a href="catalina.out">catalina.out</a>
<a href="stdout.log">stdout.log</a>

So that the browser will know what to call the file.  Of course, since
/manage/catalina.out does not exist Tomcat complains.

Is there a way I can map any request that matches /manage/logfiles/* to my
getFile.do action?  I've played around with struts wildcard mappings a bit
but couldn't get anything to work.  Any help would be much appreciated.

- AdamB

Re: Download files via a Struts action?

Posted by Michael Jouravlev <jm...@gmail.com>.
On 1/20/06, Adam B <cr...@gmail.com> wrote:
> My goal is to create a web page in my Stuts webapp with links to download
> any file in the Tomcat/logs directory.

http://wiki.apache.org/struts/StrutsFileDownload

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