Hi Restlers,
I'm building a simple client and even though I have described the
resource as @Post("json"), when I wrap the resource using
ClientResource object's wrap function and call the desired method on
the resource, it doesn't send JSON. It instead uses Java's
serialization.
Is there something I'm not doing right? I have tried Restlet 2.0, 2.1
and 2.2. Didn't work with any of them.
Here's some sample code:
In the resource definition:
public interface ContactResource {
@Post("json")
public void create(Contact c);
}
In my client application:
ClientResource cr = new ClientResource("http://myserver/contacts");
Contact c = cr.wrap(Contact.class);
c.create(xs);
What I see on the wire:
POST /contacts HTTP/1.1
Transfer-Encoding: chunked
Date: Thu, 05 Apr 2012 22:55:20 GMT
Accept: */*
Host: myserver
User-Agent: Restlet-Framework/2.0.11
Content-Type: application/x-java-serialized-object
...
Thanks in advance!
-vish
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2945010