如何从GWT调用RESTFUL服务? [英] How to call RESTFUL services from GWT?

查看:112
本文介绍了如何从GWT调用RESTFUL服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GWT作为web开发框架。我需要从我的GWT客户端代码访问一些REST服务。此外,我需要解析这些服务的响应格式JSON(或可能是XML)。哪种方法最适合这个问题?

I'm using GWT as web development framework. I need to access some REST services from my GWT client code. Also I need to parse JSON (or maybe XML) which is response format of these services. Which is the best way for this problem?

在此先感谢。

Thanks in advance.

推荐答案

您可以使用标准GWT调用REST服务 RequestBuilder (或 JsonpRequestBuilder 如果您需要在另一个域名上调用服务)。

You can call REST services using the standard GWT RequestBuilder (or JsonpRequestBuilder if you need to call services on another domain).

使用JSON响应字符串,您可以调用 JSONParser.parseStrict(jsonString)来获取 JSONValue ,它可以是 JSONObject JSONArray 等等。这些都可以在此软件包

With the JSON response string, you can call JSONParser.parseStrict(jsonString) to get a JSONValue, which can be a JSONObject, JSONArray, etc. This is all available in this package.

这篇关于如何从GWT调用RESTFUL服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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