Hello,

I usually transmit objects between client and server, but today I want to
transmet json data :)
I've no problem with a GET, but I've the following  error
  *(org.restlet.client.data.Status) Unsupported Media Type (415) -
Unsupported Media Type*
when I try to do a PUT (or a POST)...

Here is the client-side code :

                    ClientResource clientResource =
                        new ClientResource("a uri");

                    clientResource.setOnResponse(new Uniform() {

                        @Override
                        public void handle(org.restlet.client.Request
request,
                                org.restlet.client.Response response) {
                           System.out.println(response.getStatus());

                        }
                    });
                JSONObject sentObject = new JSONObject();
                sentObject.put("identifiant", new
JSONString(identifiantItem.getValueAsString()));
                sentObject.put("pwd", new
JSONString(pwdItem.getValueAsString()));
                JsonRepresentation rep = new
JsonRepresentation(MediaType.APPLICATION_JSON);
                rep.setValue(sentObject);
                clientResource.put(rep,MediaType.APPLICATION_JSON);

Any idea?
regards
Xavier

ps : generally, the examples given on the wiki or even in the book are Get
request... some examples with put and post would be good too...

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

Reply via email to