Android 上的 Restlet - 序列化问题
我正在尝试使用 Restlet 2.1 检索序列化类,其中 Android 作为客户端,GAE 作为服务器。这是相关的代码:
ClientResource cr = new ClientResource("http://localhost:8888/mydata");
// Get the MyData object
MyDataResource resource = cr.wrap(MyDataResource.class);
MyData myData = resource.retrieve();
我最初在独立的 JSE 类中测试了它,一切正常。 当我尝试在 Android 中运行相同的东西时,myData 对象为 null。有什么想法吗?
I am trying to retrieve serialized classes using Restlet 2.1 with Android as the client and GAE as the server. This is the relevant code:
ClientResource cr = new ClientResource("http://localhost:8888/mydata");
// Get the MyData object
MyDataResource resource = cr.wrap(MyDataResource.class);
MyData myData = resource.retrieve();
I initially tested this in a standalone JSE class, and everything worked fine.
When I try to run the same thing in Android, the myData object is null. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在此处查看 Android 特性:
RESTLet android 页面
我花了几个小时在理解问题之前,您需要像这样显式注册 Jackson 转换器:
You can check here the Android specificities:
RESTLet android page
I spent few hours before to understand the problem as well, you need to explicitly register the Jackson convertor like that :