DATAREST-160 Etag/If-Match based concurrency handling based on @Version Locking

Brings Etag/If-Match based concurrency handling.

This allows safely editing the same entities concurrently and will throw an HTTP Conflict response when modification have been made. This is designed for requests: PUT,PATCH,DELETE.

Every time a GET is performed on an entity that contains a version property it will add to the response an Etag header with the value of the version property.

If during the patch/put/delete of the entity an If-Match header is included it will be validated against the current version of an entity and allowed to proceed if both are still equal, else Conflict 409 response will be sent back.

If the modifying request's don't include an If-Match header operations will be allowed bypassing this validation for the sake of compatibility.

When ReturnBodyOnUpdate and/or ReturnBodyOnCreate are active the Etag will be sen't too.

NOTE!: This change depends on:
https://github.com/spring-projects/spring-data-jpa/pull/108
for it to work correctly as it fixes Spring Data jpa Version annotation detection and will fail unit tests if it is not tested against a Data JPA branch that contains the fix.


That's what I was thinking when I wrote the other comment :).