Java – restlet on Android – serialization issues

I'm trying to retrieve serialization 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 it in a separate JSE class and everything was fine When I try to run the same thing in Android, the mydata object is null Any ideas?

Solution

You can view Android features here:

It took me several hours to understand this problem. You need to explicitly register the Jackson converter:

Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>