开发者

RESTlet tutorial application does not return Java Objects (JSON only)

I've been looking the source code available from the Restlet official tutorial.

I am trying to hit the Restlet server using the Android app from he tutorial adn I only get the JSON response, not the Java Object. I tried using all libraries and extensions, nothing works. When I hit the tutorial url though ( http://restlet-examp开发者_JAVA技巧le-serialization.appspot.com/contacts/123) I get the desired response. Any ideas? BTW, I am just using the server (GAE) in the example, not the GWT frontend.


Use GSOn to convert json to java object. GSON you can get from google as its their code:

http://code.google.com/p/google-gson/

Other way:

Response res = client.handle(req); 
    ObjectRepresentation<Item> obj = new ObjectRepresentation<Item>(res.getEntity()); 
    Item item = obj.getObject(); 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜