You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Jeromy Evans (JIRA)" <ji...@apache.org> on 2008/07/08 05:10:05 UTC
[jira] Resolved: (WW-2711) Support for setting contentDisposition
dynamically for stream result type
[ https://issues.apache.org/struts/browse/WW-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jeromy Evans resolved WW-2711.
------------------------------
Resolution: Not A Problem
Assignee: Jeromy Evans
The StreamResult already includes a contentDisposition param that is evaluated.
eg.
<result name="stream" type="stream">
<param name="contentType">${contentType}</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment; filename="${fileName}"</param>
<param name="contentLength">${contentLength}</param>
<param name="bufferSize">1024</param>
</result>
where contentType, fileName, contentLength and inputStream are properties of the action.
> Support for setting contentDisposition dynamically for stream result type
> -------------------------------------------------------------------------
>
> Key: WW-2711
> URL: https://issues.apache.org/struts/browse/WW-2711
> Project: Struts 2
> Issue Type: Improvement
> Affects Versions: 2.0.11.1, 2.0.11.2, 2.1.0, 2.1.1, 2.1.2
> Reporter: S. Farshi
> Assignee: Jeromy Evans
> Priority: Minor
>
> I am using struts 2.0.11.1 and I just realized that I can not set contentDisposition dynamically. I ended up exteding the StreamResult type to allow this functionality. It would be worthwile if the StreamResult code is modified to allow this. It will only be a few lines of code. Bellow is my extension:
> public class DynamicStreamResult extends StreamResult {
> @Override
> protected void doExecute(String finalLocation, ActionInvocation invocation)
> throws Exception {
> String filename = (String) invocation.getStack().findValue(
> conditionalParse("name", invocation));
> contentDisposition = "filename=\"" + filename + "\"";
> super.doExecute(finalLocation, invocation);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.