struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grish <>
Subject Re: [S2] Parameterized File Downloading
Date Thu, 02 Aug 2007 02:50:54 GMT

Good ideas! I try them out, my only problem now is that if i try to pass the
parameter via the link, I still get the following error:

Can not find a with the name [inputStream] in the
invocation stack. Check the  tag specified for this action.

this is my action:

<package name="filedownload" extends="struts-default"

        <action name="download" class="fileDownloadAction" >
            <result name="success" type="stream">


Same as in the struts 2 showcase example but I removed the set parameter for
the action.

Then I defined my link like so:

<s:url id="downloadUrl" action="download" namespace="/filedownload">
  <s:param name="inputPath" value="/images/test.gif" />
<s:a href="%{downloadUrl}">Get image</s:a>

I check the logs and I notice my inputPath parameter in my
fileDownloadAction is null. I have a setter for my inputPath parameter so I
don't understand why it's null or why I get this error.

Is there something wrong with my setup? If I do put a parameter for the
inputPath in my action definition like in the Struts 2 showcase example, it
works fine. Any ideas?

DNewfield wrote:
> Grish wrote:
>> Hmmm good point. So does this mean that the only secure way of having
>> downloads is to have specific actions for each download? Or is there a
>> better approach?
> I don't claim to know what the best approach is.  As long as your action 
> does sufficient validation of the specified input path (like checking 
> against a whitelist, or only allowing from certain directories (check 
> for ".." path segments!)), your approach may be OK.  I tend to have a 
> separate action for each "category" of stuff downloaded from my app 
> (along with category-specific validation).  Since I don't know your 
> requirements, I cannot know that that is applicable for you.
> -Dale
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Struts - User mailing list archive at

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

View raw message