• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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?
 
Rancher
Posts: 43081
77
  • 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.
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic