This content has been marked as final.
Show 2 replies
-
1. Re: FacesContext responseComplete + response sendRedirect
danielserva Dec 16, 2011 4:51 AM (in response to ricardo.gomes)Hi Ricardo.
Did you get to solve this problem?
I'm having a similar issue.
My download only works once and don't know why.Any help?
regards,
Daniel Serva -
2. Re: FacesContext responseComplete + response sendRedirect
mikkus70 Dec 16, 2011 12:34 PM (in response to ricardo.gomes)You cannot download and redirect at the same time, this is simply a limitation of the HTTP protocol (it has nothing to do with Seam or JSF): when processing a request either you provide a single response (a webpage or a download) or you redirect to another resource. You cannot do both at the same time.
Possible workarounds for this issue are:
- Open download in a separate browser window (using an onclick javascript action). This does not work if javascript is disabled. This also requires you to have a RESTful link to the file you're trying to download.
- Serve response with a <refresh> meta tag (that makes the page reload). On refresh, issue the response. This also requires javascript, I think (I have never used this solution).
- Redirect and serve download file from an iframe embedded in the redirected-to page. This is my preferred solution, as it does not require javascript.