Hello Hubert,

As said Stephan, a JsonRepresentation is only able to generate
representations with the json format.
You can use the Form class, and its getWebRepresentation if you intend to to
send a "application/x-www-form-
urlencoded" representation.

Having said that, you can handle json representations on the server side
(using jackson, xstream, etc), and if you are using Restlet on server side,
things get quite simpler.
http://wiki.restlet.org/docs_2.1/13-restlet/303-restlet.html

Best regards,
Thierry Boileau


 Hi Hubert,
>
>
>  Representation rep = *new JsonRepresentation(myJsonObject)*;
> rep.setMediaType(MediaType.APPLICATION_WWW_FORM);
> Request request = new Request(Method.POST, "http://127.0.0.1:8080/myServlet"; 
> <http://127.0.0.1:8080/myServlet>,rep);
> Response response = client.handle(request);
>
> But the servlet *receive a JSONObject* :
> {"param1":"value1",....}
>
>  You send a JSON-Object, and you get one. The computer does always what you
> ask him to do ... ;-)
>
> I think you should send a form, but I don't know, ho to do this now.
>
> good luck
>    Stephan
>

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

Reply via email to