Thanks Thierry for the below response. I'm not using GWT for my implementation. Which by the way could have been great If Restlet documentation also included examples and description for a non-biased client solution that could fit into any client with ability to perform HTTP calls - for let say - iPhone Native Apps (Where GWT client is not an option - at least not without some hacking/bending)
Actually in my project I'm using curl type of client (can't go into too much details) - So I guess it falls somewhere between Web Form and Ajax meaning I can control the HTTP Headers, Content Type and the payload structure. I will definitely update when I gain some progress after studying your below suggested options, Best, Chen. On Tue, Apr 13, 2010 at 10:47, Thierry Boileau <[email protected]>wrote: > Hello Chen, > > from what I understand, you aim at sending a json representation and > converting it into an Item object. How do you send the json representation? > Are you using a Web form, an AJAX client, GWT? > In the first case, the json representation is wrapped in a field (I think > you called it "json" from what I notice in your second mail), but the whole > representation caught by the server is clearly a web form, so don't update > the entity's content type. > In this case, you can provide your own converter that accepts Web forms > (media type application/x-www-form-urlencoded) and transform them into an > objects. > I send you such sample converter (not tested). You will also have to > register it by adding a service descriptor (have a look at the src/META-INF > directory in the xstream extension). I have to say that I'm not a huge fan > of wrapping representations into a web form. > > In the second case (with AJAX), you seem to use the xstream converter on > server side (which leverages a patched version of xstream). You have to > manually generate an entity compatible with the xstream form. It looks like: > {"<package>.Item": {<json representation of Item's class attributes>}} > > I hope this will help you. > > Best regards, > Thierry Boileau > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2580506 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2580602

