> Not setting the Content-disposition is header, makes the firefox to 
prompt for the download but it uses the action for filename ie 
Ticket.action. > Has anyone faced a similar issue or can provide a hint on 
how to fix the issue

Yep, saw this problem just this week.

I ran the request through software that would allow me to view the header 
and I saw that only the filename appeared in the contentDisposition, no 
"filename="...
Add a field to your action class called contentDisposition and assign it 
like this:
contentDisposition = "filename=\"" + filename + "\"";

This assumes you are using the stream result in a manner similar to this:
        <result name="myDownloadName" type="stream">
                <param name="bufferSize">1024</param>
        </result>

I included the contentDisposition in the result like this:

        <result name="myDownloadName" type="stream">
                <param name="contentType">${contentType}</param>
                <param 
name="contentDisposition">filename=${contentDisposition}"</param>
                <param name="bufferSize">1024</param>
        </result>

But that didn't work, because Struts took whatever was in my 
contentDisposition in my action versus using the param. So _the above 
doesn't work_ because it would drop the "filename=" portion. If you used a 
different variable name, then it would probably work, but I didn't go back 
and try. In theory, this would work:

        <result name="myDownloadName" type="stream">
                <param name="contentType">${myContentType}</param>
                <param 
name="contentDisposition">filename=${myContentDisposition}"</param>
                <param name="bufferSize">1024</param>
        </result>

Assuming you had myContentType and myContentDisposition in your action.

Hope that helps.

Reply via email to