跨域REST / Jersey Web服务与CORS [英] Cross domain REST/Jersey web services with CORS

查看:441
本文介绍了跨域REST / Jersey Web服务与CORS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用CORS(跨源资源共享)来创建跨域REST Web服务。

我需要知道


  1. 从服务器端角度来看,需要做哪些代码/配置更改?


  2. 如何从HTML5 / js调用此服务

    / li>

感谢

解决方案

您可以在 enable-cors.org 找到您的服务器端配置的信息。



没有必要更改任何代码客户端,但我建议在使用之前检查CORS的浏览器功能。可以找到测试代码,例如此处


I want to make Cross domain REST web services with CORS(Cross-Origin Resource Sharing). I am using Jersey Libraries for making services.

I need to know

  1. What code/configuration changes i need to do from server side perspective?

  2. How to invoke this services from HTML5/js.

Thanks

解决方案

All the information for your server side configuration can be found at enable-cors.org.

There is no need to change any code clientside, but I would recommend checking the Browsers capability for CORS before using it. Testing code can be found, e.g., here.

这篇关于跨域REST / Jersey Web服务与CORS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆