how to allow cross domain requests on tomcat?

ajax, cross-domain, rest, same-origin-policy, tomcat6

Solution

If you're able to focus on modern browsers, I suggest looking into a Java implementation of Cross Origin Resource Sharing, or `CORS`, perhaps like this one.

Mozilla introduced CORS in FF3.5 and it's since become pretty widely adopted. IE introduced a competing, stricter standard `XDomainRequest` called that doesn't leak cookie information, but only IE supports it.

IE is slated to support CORS in IE 10, which makes it the technique of choice.

Problem

I am deploying a web app on 2 separate domains, the first web app is a restful service deployed on tomcat 6, the second is a static content (html, java script), the java script from the static content domain will call the restful service. but the same origin policy is not allowing this, my question is: how to allow cross domain requests on tomcat?

Original source