On 09/21/2011 05:55 PM, Ralf Jung wrote:
Actually I was quite surprised to see that POST can also be used to store documents, which I'd usually expect to be the behaviour of PUT - it seems the both are almost the same in BaseX?
I think POST should be used if the server decides how to name the resource and PUT if the user decides how to name the resource. The nice thing about PUT is that it's idempotent.
Thus I would suggest that it's possible to create resources with POST but the BaseX-server decides how to name the resource, that is the URI in a POST-request only "identifies the resource that will handle the enclosed entity"[1]. It maybe shouldn't be possible to specify the resource name in the URL using the POST method, just the database within the new resource should be created, but the resource name is up to the BaseX-server and a Location header should point to the new created resource.
kind regards, Johannes
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html -- section 9.6 PUT