Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cross Origin Resource Sharing in Tomcat6  RSS feed

 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a webapp that logs into Tomcat A for its initial call. The JSP file that gets returned needs to get periodic updates from Tomcat B and Tomcat C by using Dojo ajax calls. Luckily the project requires require support for only Firefox 8+, which means that the Access-Control-Allow-Origin header should be enough to fix this problem. I was looking at the CORS Filter. It looks like it could solve the problem, but the security team is too backed up that they wouldn't have time to vet it until long after the delivery date.

Is there some way to configure Tomcat to enable CORS? I saw some mention of a crossdomain.xml file in some Flex discussions but have not found any documentation on how to use it. Is the only option available to create a Servlet Filter that mirrors the CORS Filter or does anyone know of some alternatives?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
crossdomain.xml is used by Flash/Flex, not web browsers in general.

When I implemented it some time ago for a web app I studied https://developer.mozilla.org/En/HTTP_access_control and http://dev.w3.org/2006/waf/access-control/. I implemented it in the main servlet through which all accesses passed, but a filter would work just as well, I supposed. All in all it was less than 50 lines of code including comments, IIRC.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!