Hello Andre, I send you a sample Eclipse project with your code. I order to make it run, you need at least the following jars: - org.restlet.jar (core module) - org.restlet.ext.json.jar (json extension that allows automatic serialization/deserialization) - org.json.jar (dependency)
Best regards, Thierry Boileau 2014-06-27 14:51 GMT+02:00 AAlefeld <aalef...@gmail.com>: > Hi, > > I am a newbie to restlet api and I started using restlet 2.2.1 and have > a running restlet app with resources that can be accessed via GET > request. They return a json string, e.g. localhost:8182/myresource > gives a list like [ res1, res2, res3 ] > > I wanted to add a put method now to store/modify a resource and added > > @Put > public void storeResource(JSONObject json) { > System.out.println("Put resource: " + json); > // real handling goes here > } > > rebuilt and restarted the server > > curl -v http://localhost:8182/create -X PUT -H "Content-Type: > application/json" -d '{"res3": {"name":"test", "setting":"ud"}}' > > I would expect to get the object printed out on the server side, instead > I run always into: > ... > < HTTP/1.1 405 Method Not Allowed > ... > <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Method > Not Allowed</p> > <p>The method specified in the request is not allowed for the resource > identified by the request URI</p> > ... > > In the javadocs I read something about the default implementation of put > in Representation to always set > Status.CLIENT_ERROR_METHOD_NOT_ALLOWED > > How can I achieve that my PUT/DELETE etc. requests are accepted ? > > thanks for any help, > Andre > > ------------------------------------------------------ > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3084088 > ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3084091