Right, I figured that it wasn't a struts specific issue, but thought that I
might have been using the wrong content disposition or something along those
lines.
However, upon further prodding, it seems that this is more an issue of response
time with the browser.
I found that the behavior I was seeking worked with the JasperReports plugin.
The user clicked on a .action link and got a PDF. Right clicking to save as
gave them the .pdf as well.
However, if I set a break point in my report generation code to halt it, the browser forces the "Save as" dialog to appear, but at this point it hasn't received any response yet, so it doesn't know
what the content disposition, and instead of the usual filename being set to a PDF, I get the same "bad" behavior of it saving as the action name. This kind of makes sense from the browsers
perspective though, since it'd be odd to click to save a link, only to have the browser apparently hang while the dialog waits for a response.
My problem really then, is that my action to make a zip simply takes too long
to do its thing, and the browser refuses to wait.
I'm not sure if theres really a workaround for this, other than writing to disk
and linking directly to the file.
I'm not sure what other parts of my config you need, but heres the struts.xml
for that action:
<action name="DownloadFile" class="action.DownloadFileAction">
<result name="success" type="stream">
<param name="inputName">inputStream</param>
<param name="contentType">application/octet-stream</param>
<param name="contentDisposition">attachment;
filename="${fileName}.zip"</param>
</result>
<result name="input" type="redirect">ViewDownloadForm.action</result>
</action>
Thanks,
Tim
Dale Newfield wrote:
Timothy Orme wrote:
I still have the same issue though. Right clicking the link doesn't
work and the filename is still listed as the action.
As far as struts is concerned, there's no difference between a request
that's going to be displayed in a browser window and a request that's
going to be saved by the browser to a file. I'd start by looking at
URLs and logs and seeing how those requests differ from one another. For
example, make sure your browser (or proxy or something) isn't showing
you a cached version of the left-click result.
If you want help, you need to provide enough of your configuration for
us to diagnose what's going on, assuming the request is being mapped to
that action.
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org