开发者

Getting Json data from another domain, within a proxy servlet

I'm working on a GWT project, in which I have to fetch some JSON data from a real web-domain. Due to SOP policy, GWT fails to get those data.

To address this, as suggested in GWT docs, I have created some proxy servlets within GWT, which in turn should call the actual JSON provider external url.

Does anybody know how should I r开发者_JAVA百科etrieve json data from an external url, within a servlet?

Thanks


Use java.net.URLConnection.

InputStream input = new URL("http://example.com/data.json").openStream();

See also:

  • How to fire and handle HTTP requests using URLConnection?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜