XmlFileHandler now supports create on PUT
i updated my
XmlFileHandler module to support creating new resources on PUT. this allows folks to name their resource directly. now, instead of POSTing a new document to the location (/my-documents/) and then having the server generate a unique resource id, users can PUT the new document directly to the resource location (my-documents/my-resource-name). i also made this a switch when defining the resource (
AllowCreateOnPut = true;) that is set to
false by default.
while this is good news, it's still only partially done. to make create on PUT safe, i should enforce ETag support for PUTs. that means i should require
Not-Modified-Since headers for PUT updates. i need to review this to make sure, but i suspect that, if
AllowCreateOnPut = true; then all update PUTs should be required to supply
that will take a bit of planning, but shouldn't be too tough.
ha! it just dawned on my that i can use a HEAD request with
Cache-Control: no-cache to pull the most recent ETag/Last-Modified value of any object in the system! that's a quite a simple way to implement the solution to the lost update problem.
nice to know that something like this is already in place in the exyus framework!