RE: firstResource tutorial: item put vs. items post
Hi Daniel, To complete, PUT method has precise semantics saying that it can be retrieved if needed without side-effect (it is idempotent), which isn’t the case of POST for example. Therefore, in case on network error, the ClientResource class might be able to automatically retry a PUT request for you. Best regards, Jerome Louvel -- Restlet ~ Founder and Technical Lead ~ http://www.restlet.org/ http://www.restlet.org Noelios Technologies ~ http://www.noelios.com/ http://www.noelios.com De : Thierry Boileau [mailto:thierry.boil...@noelios.com] Envoyé : jeudi 25 février 2010 08:36 À : discuss@restlet.tigris.org Objet : Re: firstResource tutorial: item put vs. items post Hello Daniel, apparently PUT updates an existing item if found yes, and it creates it if not found. One important condition is that you know (by advance, if the resource does not exist yet) the resource's identifier (its URI). POST is a more generalist operation that allows the target resource to act on its own state (if it exists...). It is used, for example, to create a resource when you don't know by advance its URI. By convention, you send a POST request to an container resource (such as items), and in return, you can get the URI of the created resource (if the container validates the request). I hope this makes the things clearer. Best regards, Thierry Boileau hello everyone, I'm a new user working through the Restlet tutorials (Restlet 2.0m7, java 1.6, running standalone (no servlet container) from eclipse). So far I'm enjoying using Restlet, which seems very straightforward, especially compared to other java web technologies. From the firstResource tutorial, I'm trying to understand the distinction between creating a new item via PUT (ItemResource) vs. POST (ItemsResource). The two methods appear to do the same thing—create a new Item—with the only distinction being that apparently PUT updates an existing item if found whereas the POST implementation complains if you try to change or re-add an existing item. What is the rationale for this apparent duplication? Thanks in advance, dan -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2451651 dsMessageId=2451651 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2452565
firstResource tutorial: item put vs. items post
hello everyone, I'm a new user working through the Restlet tutorials (Restlet 2.0m7, java 1.6, running standalone (no servlet container) from eclipse). So far I'm enjoying using Restlet, which seems very straightforward, especially compared to other java web technologies. From the firstResource tutorial, I'm trying to understand the distinction between creating a new item via PUT (ItemResource) vs. POST (ItemsResource). The two methods appear to do the same thing—create a new Item—with the only distinction being that apparently PUT updates an existing item if found whereas the POST implementation complains if you try to change or re-add an existing item. What is the rationale for this apparent duplication? Thanks in advance, dan -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2451651
Re: firstResource tutorial: item put vs. items post
Hello Daniel, apparently PUT updates an existing item if found yes, and it creates it if not found. One important condition is that you know (by advance, if the resource does not exist yet) the resource's identifier (its URI). POST is a more generalist operation that allows the target resource to act on its own state (if it exists...). It is used, for example, to create a resource when you don't know by advance its URI. By convention, you send a POST request to an container resource (such as items), and in return, you can get the URI of the created resource (if the container validates the request). I hope this makes the things clearer. Best regards, Thierry Boileau hello everyone, I'm a new user working through the Restlet tutorials (Restlet 2.0m7, java 1.6, running standalone (no servlet container) from eclipse). So far I'm enjoying using Restlet, which seems very straightforward, especially compared to other java web technologies. From the firstResource tutorial, I'm trying to understand the distinction between creating a new item via PUT (ItemResource) vs. POST (ItemsResource). The two methods appear to do the same thingâEURcreate a new ItemâEURwith the only distinction being that apparently PUT updates an existing item if found whereas the POST implementation complains if you try to change or re-add an existing item. What is the rationale for this apparent duplication? Thanks in advance, dan -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2451651 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2451860