Hello Bruno,
The converters are available via the usage of an Application (ie via the
Appication#converterService).
I suggest that you serve the sample TestServerApplication just as follow:
public static void main(String[] args) throws Exception {
Component c = new Component();
c.getServers().add(Protocol.HTTP, 8182);
c.getDefaultHost().attach(new TestServerApplication());
c.start();
}
Best regards,
Thierry Boileau
I'm trying to create my first application (
> http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html#dsy303-restlet_jse)
> outside without GAE.
>
> So I have the 3 classes: Contact (serializable), Address (serializable) and
> ContactResouce
>
> Created the ContactServerResource which implements ContactResource (public
> class ContactServerResource extends ServerResource implements
> ContactResource) and runs with this:
> new Server(Protocol.HTTP, 8182, ContactServerResource.class).start();
>
> Now I'm trying to create a ContactClientResource that is able to retrieve,
> store and delete the contact in ContactServerResource without GAE:
> ClientResource clientResource = new ClientResource("http://localhost:8182
> ");
> ContactResource contactResource =
> clientResource.wrap(ContactResource.class);
> Contact contact = contactResource.retrieve();
> System.out.println(contact);
> Pops the following error:
> org.restlet.service.ConverterService toObject
> AVISO: Unable to find a converter for this representation :
> [text/plain,UTF-8]
>
> Also, when trying to modify the information with:
> contactResource.store(modifiedContact);
> I get the following error: org.restlet.service.ConverterService
> toRepresentation
> AVISO: Unable to find a converter for this object
>
> I've also tried modifying the @Get annotation to @Get("json") in the
> retrieve method in ContactResource, and using
> clientResource.get(MediaType.APPLICATION_JSON).write(System.out); in the
> client code, but didn't work also:
> org.restlet.service.ConverterService toRepresentation
> AVISO: Unable to find a converter for this object :
> br.org.bmnds.restlet.firstapplication.Contact@1c92535
> And I've added both JSON extension and org.json.jar.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2725234
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2730113