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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to