You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pedro Herrera <pe...@hotmail.com> on 2007/05/20 02:25:22 UTC

S2 - for a StreamResult parameters dynamics

I need to pass dynamic parameters for a DownLoadFile Action. I´ve seen the
source of StreamResult and for example :
        oResponse.setContentType(conditionalParse(contentType, invocation)); 

in my opinion, the correct shoud be :
     
        oResponse.setContentType( (String)
invocation.getStack().findValue(conditionalParse(contentLength,
invocation)));

to provide dynamic parameters, like inputStream param , isn´t ?


Thanks

Herrera

-- 
View this message in context: http://www.nabble.com/S2---for-a-StreamResult-parameters-dynamics-tf3784148.html#a10701802
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: S2 - for a StreamResult parameters dynamics

Posted by Pedro Herrera <pe...@hotmail.com>.
Thanks !! It works fine now !!!!!

How I know which fields are on the value stack ??  Where I found this
information in the struts2 docs ?

Best Regards

Herrera



Jeromy Evans - Blue Sky Minds wrote:
> 
> I'm not sure if you're proposed change is an improvement or not, but in 
> 2.06 dynamic parameters do work for contentType, contentLength, 
> contentDisposition and the input stream name.
> 
> ie. I use this:
> <result name="download" type="stream">
>   <param name="inputName">myStream</param>
>   <param name="contentType">${contentType}</param>
>   <param name="contentLength">${contentLength}</param>
>   <param name="contentDisposition">attachment;
> filename=${filename}</param>
> </result>
> where contentType, contentLength and filename are on the value stack.
> 
> The only problem I've encountered with these dynamic params is that you 
> can't set them to blank values or force them to not be included as 
> StreamResult uses the default value instead.  I haven't check if there's 
> anything on JIRA for this.
> 
> If you need anything more than this you can write your own custom result 
> type based on StreamResult and register it in struts.xml.  See 
> http://struts.apache.org/2.x/docs/result-configuration.html
> 
> Pedro Herrera wrote:
>> I need to pass dynamic parameters for a DownLoadFile Action. I´ve seen
>> the
>> source of StreamResult and for example :
>>         oResponse.setContentType(conditionalParse(contentType,
>> invocation)); 
>>
>> in my opinion, the correct shoud be :
>>      
>>         oResponse.setContentType( (String)
>> invocation.getStack().findValue(conditionalParse(contentLength,
>> invocation)));
>>
>> to provide dynamic parameters, like inputStream param , isn´t ?
>>
>>
>> Thanks
>>
>> Herrera
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/S2---for-parameters-dynamics-in-StreamResult-tf3784148.html#a10711422
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: S2 - for a StreamResult parameters dynamics

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
I'm not sure if you're proposed change is an improvement or not, but in 
2.06 dynamic parameters do work for contentType, contentLength, 
contentDisposition and the input stream name.

ie. I use this:
<result name="download" type="stream">
  <param name="inputName">myStream</param>
  <param name="contentType">${contentType}</param>
  <param name="contentLength">${contentLength}</param>
  <param name="contentDisposition">attachment; filename=${filename}</param>
</result>
where contentType, contentLength and filename are on the value stack.

The only problem I've encountered with these dynamic params is that you 
can't set them to blank values or force them to not be included as 
StreamResult uses the default value instead.  I haven't check if there's 
anything on JIRA for this.

If you need anything more than this you can write your own custom result 
type based on StreamResult and register it in struts.xml.  See 
http://struts.apache.org/2.x/docs/result-configuration.html

Pedro Herrera wrote:
> I need to pass dynamic parameters for a DownLoadFile Action. I´ve seen the
> source of StreamResult and for example :
>         oResponse.setContentType(conditionalParse(contentType, invocation)); 
>
> in my opinion, the correct shoud be :
>      
>         oResponse.setContentType( (String)
> invocation.getStack().findValue(conditionalParse(contentLength,
> invocation)));
>
> to provide dynamic parameters, like inputStream param , isn´t ?
>
>
> Thanks
>
> Herrera
>
>   


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