跨源资源共享是一种支持跨源请求的机制[1] 。 正如您可以在链接[1]中看到的那样,在Apache Tomcat 7中启用CORS很容易。只需要在文件web.xml进行configuration即可。
web.xml
当我正在testing通常在Tomcat上执行的Glassfish的服务以决定从Tomcat到Glassfish的迁移时,我需要在Glassfish上启用CORS。
又怎样?
我正在使用Glassfish 3.0.1。