Share via


Client Uses Server-Side Conflict Detection

Topic Last Modified: 2006-06-12

The following scenario uses server-side conlict detection to avoid uploading content to the server:

Client A has previously downloaded resource 'docE' and its corresponding resourcetag.

Request

GET /docs/docE HTTP/1.1

Response

HTTP/1.1 200 OK
ResourceTag: <rt:doc-01>
Content-type: text/plain
Content-length: {insert length here}

This is the content of text document docE.

Client A goes offline and makes changes to resource 'docE'. In the meantime, Client B changes the contents of resource 'docE' on the server, thus resulting in a different resourcetag.

Client A comes online and needs to upload its changes to resource 'docE' on the server only if the client and server state of the resource are same. Using the in the resourcetag in the If Header, the PUT method request fails because the resourcetag the client previously obtained doesn't match the resourcetag of the new resource on the server.

Request

PUT /docs/docE HTTP/1.1
Host: example.org
If: (<rt:doc-01>)
Content-type: text/plain
Content-length: {insert length here}

New contents of resource docE

Response

HTTP/1.1 412 Precondition Failed