Custom Headers on a Web Script

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2012 11:25 PM
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
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
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2012 01:19 PM
That sounds like a bug to me - have you created a bug report in the issue tracker [1]?
It also seems quite strange that even a filter doesn't work. Have you tried monitoring the headers (e.g. using a debugger) as the response flows back out of Tomcat, to see where the header gets removed?
Cheers,
Peter
[1] http://issues.alfresco.com/
It also seems quite strange that even a filter doesn't work. Have you tried monitoring the headers (e.g. using a debugger) as the response flows back out of Tomcat, to see where the header gets removed?
Cheers,
Peter
[1] http://issues.alfresco.com/

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2012 04:28 PM
No, I haven't created an issue. I wasn't aware community server user could create issues. Will do that next. I've monitored the headers on the client side (using firebug in Firefox and Fiddler on IE), and the response gets to my computer without the header on the POST response only. All the other responses (while navigating inside the alfresco app and the OPTIONS response) do have the header in them.
How would I be able to debug the response flow in tomcat. A software tool? A log in tomcat?… google keywords? hehehe I'm mostly a javascript, html, .net developer. Java, tomcat and apache are not my strong suits.
Thanks for the quick reply,
Frank
How would I be able to debug the response flow in tomcat. A software tool? A log in tomcat?… google keywords? hehehe I'm mostly a javascript, html, .net developer. Java, tomcat and apache are not my strong suits.
Thanks for the quick reply,
Frank
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 08:38 AM
The issue still exists as of 11.12.2015 (Alfresco 5.0.d Community Edition).
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2015 05:28 PM
I'll give you suggestion, you can create a project under /tomcat/webapps/ROOT and you'll be able to read the response then you can send it to your application, I think this is two way solution. Reading the response from application under alfresco root then send it to other application outside alfresco and you can add header and everything you need.
