|K. Ari Krupnikov||Feb 8, 2004 4:59 pm|
|David Megginson||Feb 8, 2004 5:42 pm|
|K. Ari Krupnikov||Feb 8, 2004 8:58 pm|
|Seairth Jacobs||Feb 9, 2004 5:45 am|
|Seairth Jacobs||Feb 9, 2004 5:51 am|
|David Megginson||Feb 9, 2004 6:21 am|
|Bullard, Claude L (Len)||Feb 9, 2004 7:07 am|
|Bullard, Claude L (Len)||Feb 9, 2004 7:43 am|
|David Megginson||Feb 9, 2004 8:19 am|
|Bullard, Claude L (Len)||Feb 9, 2004 8:26 am|
|K. Ari Krupnikov||Feb 9, 2004 11:35 am|
|K. Ari Krupnikov||Feb 9, 2004 1:00 pm|
|Bullard, Claude L (Len)||Feb 9, 2004 1:45 pm|
|K. Ari Krupnikov||Feb 9, 2004 2:43 pm|
|Bullard, Claude L (Len)||Feb 9, 2004 2:51 pm|
|Jim Ancona||Feb 9, 2004 3:04 pm|
|David Megginson||Feb 9, 2004 4:46 pm|
|Seairth Jacobs||Feb 9, 2004 6:24 pm|
|K. Ari Krupnikov||Feb 10, 2004 9:54 pm|
|K. Ari Krupnikov||Feb 10, 2004 10:13 pm|
|Pete Kirkham||Feb 11, 2004 2:26 am|
|Julian Reschke||Feb 11, 2004 2:54 am|
|Klotz, Leigh||Feb 11, 2004 10:18 am|
|Robin Berjon||Feb 11, 2004 10:21 am|
|Chiusano Joseph||Feb 26, 2004 6:18 am|
|Michael Champion||Feb 26, 2004 7:29 am|
|Bullard, Claude L (Len)||Feb 26, 2004 7:51 am|
|Subject:||Re: [xml-dev] A question about REST and transaction isolation|
|From:||David Megginson (dmeg...@attglobal.net)|
|Date:||Feb 9, 2004 4:46:15 pm|
K. Ari Krupnikov wrote:
User A GETs a resource and edits it. User B GETs a resource and edits it. User A PUTs the modified resource back. User B PUTs her version of the modified resource back, unaware of A's edits. A's edits are lost without anyone noticing. What I want to happen is B to get a 409 "Conflict" or some such.
I'm not sure how well REST provides answers to the problem of moving resources around. Your problem is that the server, user A, and user B all have copies of the same information, and the server has to decide whether to accept or reject user B's version after user A has already done a checkin.
One easy solution is to add a sequence number or checkout date to each XML document:
<pilot-record seq="123"> <name>Ari Krupnikov</name> <license-type>private - aeroplane</license-type> <types> <type>single engine land</type> </types> <ratings> <rating>IFR single engine</rating> </rating> </pilot-record>
When I send this back, the server checks my sequence number (or date) against the highest sequence number checked back in for Ari's data record; if the last checkin was, say, 111, then my information goes in; if the last checkin was 125, it rejects (at which point my client can check out the newest version and perhaps try to merge my previous changes into it).
Of course, it is easy for the client to cheat by simply bumping up the sequence number and resubmitting, but then again, the client can arbitrarily change information anyway -- it's just a matter of letting people know when there might be a conflict.
If you wanted something more secure, you could figure out a system of hashes and signatures against the original document accompanied by a list of changes, but that's probably getting into silly territory again unless this is a defence application or something similar.
As far as REST goes, the URL on the server always points to the server's current version of the information (the last checkin it accepted) -- that's about it.
All the best,