Today I worked an an issue which presented users of our application a 403 error page when downloading large files which were generated on the fly. The files were delivered by a servlet and the files were directly copied to the ServletOutputStream, so the files were streamed instead of holding them in memory.
After some debugging it turned out, that the files were not streamed since the Seam Ajax4JSF Filter doesn’t allow to stream files and this resulted in OutOfMemoryExceptions. There are a few ways how to disable or extend the Ajax4JSF Filter (see this Seam Forum Thread).
Since all our download resources are mapped to servlets which resides in the „/media/*“ path, it was pretty easy to just enable the Ajax4JSF Filter for all paths except the „/media/*“ paths. To achieve this, just add to your components.xml:
<web:ajax4jsf-filter regex-url-pattern="^(?:[^/]|/(?!media/))*$"/>