消费在Android上,最简单的方法REST服务?最简单、方法、Android、REST

由网友(残留的悲伤)分享简介:我有一个REST服务,并希望与Android使用它。服务(JAX-RS)发布JSON数据。因此,主要问题有:I have a REST Service and want to consume it with Android. The service (JAX-RS) publishes JSON data. So t...

我有一个REST服务,并希望与Android使用它。服务(JAX-RS)发布JSON数据。因此,主要问题有:

I have a REST Service and want to consume it with Android. The service (JAX-RS) publishes JSON data. So the main question are:

有什么好准备使用的解决方案为Android,如果没有,还能有什么建议? 我想传递的POJO,我怎么会知道呢?是GSON一个合适的方法?

感谢您

推荐答案

由于API级别8,你可以使用的 AndroidHTTPClient 或更早的API,您可以使用 DefaultHttpClient ,没有任何问题,并利用发送数据 HttpPost HTTPGET 。对于 JSON 编码数据,是 GSON 是一个好方法,但我认为的 org.json 会比较容易上手。

Since API Level 8 you could use AndroidHTTPClient , or for earlier APIs you can use DefaultHttpClient with no problems, and send data using HttpPost or HttpGet. For encoding data in JSON, yes GSON is a good approach, but I think that org.json would be more easy to use.

阅读全文

相关推荐

最新文章