Hi,
what is the preferred way of passing a java object from server to client and
vice versa? Since the getEntityAsObject() is deprecated how can an object be
deserialized on the client side?
e.g.:
##################### CLIENT
req.getClientInfo().getAcceptedMediaTypes().add(new
Preference<MediaType>(MediaType.APPLICATION_JAVA_OBJECT));
Response res = client.handle(req);
// how to get the Item object from the response
####################
#################### SERVER Ressource.represent(Variant variant)
if(MediaType.APPLICATION_JAVA_OBJECT.equals(variant.getMediaType())) {
Item item = new Item("object","APPLICATION_JAVA_OBJECT presentation");
ObjectRepresentation<Item> obj = new
ObjectRepresentation<Item>(item);
return obj;
}
###################
Item is a simple class with two string attributes.
I read some old posts in the list recommending serializing/deserializing
objects with libraries like XStream or Simple to XML/JSON. Is this the
recommended way? Should I request the XML/JSON MediaType then instead of
APPLICATION_JAVA_OBJECT?
Regards,
Ruben
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1059265