【发布时间】:2014-04-01 10:05:00
【问题描述】:
我使用 RESTEasy 创建了 POST 服务,它在 chrome 插件中运行。 但是使用 ajax 我无法调用该服务。 得到错误
XMLHttpRequest cannot load http://localhost:8080/RESTEasyJSONExample/rest/jsonServices/send. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access.
这是因为客户端和服务器的 url 不同, 但我希望该服务器应该允许来自任何 url 的请求。所以我需要在rest api中实现CORS。我该怎么做。
【问题讨论】:
标签: jquery ajax rest cors resteasy