Hello,
I'm looking for info about automatic conversion from java object to json 
in restlet.
I have read this thread [http://markmail.org/thread/g7u4rmje64rhk6q5] 
and the resulting page in the wiki
[http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/285-restlet.html] 
but I have still some problems to
make it works.
I have a resource to retrieve customer profile :

public class ProfileResource extends ServerResource {

        @Get    
        public Representation getJson() throws ResourceException {
                
                // get Profile object matching the request
                [...]
                Profile profile = new Profile();
                JSONObject jsonProfile = new JSONObject(profile);
         getResponse().setStatus(Status.SUCCESS_OK);
         return new JsonRepresentation(jsonProfile);
        }
}

So from what I have read, I can declare my annotated method to return 
directly a Profile object, and not a Representation.

Now if I try to get the profile, no converter can be found ( ATTENTION: 
Unable to find a converter for this object : [...] )
either with curl with header Accept set to json or xml, or using a 
browser, so I don't get any entity in response.
My questions here are :
How can I specify make my object to be automatically converted to xml or 
json ? change something in my object itself, or
in my resource ? Or maybe I need my own /ConverterHelper/ ? If so, is 
there any documentation or guide line for this task
(I have found nothing yet) ?

Thanks for any help,
Laurent.
-- 
Laurent Rustuel,
Alten contractor for Alcatel-Lucent, Brest

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2390950

Reply via email to