We've got a project where we have a page that uses plupload (a js library for uploads), and this project is hosted on a different server than our alfresco set up. This is causing a Cross-domain issue. I've already have set up a filter for alfresco's tomcat to add the Access-Control-Allow-Origin header so that pupload works. Also I've already created a java backed web script (using a AbstractWebScript implementation) to serve the OPTIONS response that the browser needs before the POST request. The OPTIONS request works fine, and also the POST webscript receives and saves the file properly. But the POST response doesn't include the Access-Control-Allow-Origin header. I've tried using filters at the alfresco webapp level and at the tomcat root level, to include the headers at the response and it adds it to all the other responses of the webapp, but not to the POST webscript response. Right now the only other option I can think about is implementing an AbstractWebScript for the POST web script, but I still am puzzled by why the response of the post doesn't include the header after configuring the filters when every other response does include it.
My question is: Does anyone know of another way to add custom headers to web script responses or why a filter wouldn't affect a POST web script? If none of this has a clear answer, then can anyone point me to a simple tutorial on how to create an AbstractWebScript that receives a file stream and saves it on a folder inside a user's work space?
Thanks,
Frank