struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Struts Two <>
Subject Enhancing "stream" type result
Date Mon, 07 Jul 2008 19:18:15 GMT
I am using struts and I just realized that you can not dynamically set the filename
using stream result (at least that is my impression after a few hours of tweaking around the
I ended up extending StreamResult to set contentDisposition dynamically. I think it would
be worthwhile if the code is modified to accomediate this functionality[it would be only a
few lines of code added]. Here is my extension
public class DynamicStreamResult extends StreamResult {
 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);

Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites.
Download it now at

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

View raw message