• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Cross Origin Resource Sharing in Tomcat6

Ranch Hand
Posts: 144
Oracle Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
Posts: 43081
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic