DATAREST-348 - Support for json-patch+json and merge-patch+json media types.

We now support PATCH request with application/json-patch+json [0] and application/merge-patch+json media types. The support is based on some customized usage of the FGE JSON Patch library [2]. 

As we need to apply the patch to an existing object, we need translate the JSON Patch remove operation into a replace operation setting the value to null so that out entity processing component registers the request for removal. Same applies to requests for merge-patch+json.

From an implementation point of view the handling of the media type has moved from the controller into PersistentEntityResourceHandlerMethodArgumentResolver and its delegates, n particular JsonPatchHandler. The application of the changes to the existing domain object is handled in the newly introduced DomainObjectReader.

Related ticket: DATAREST-345.

[0] http://tools.ietf.org/html/rfc6902
[1] http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch
[2] https://github.com/fge/json-patch
This commit is contained in:
Oliver Gierke
2014-07-08 14:03:48 +02:00
parent ca2e88ae34
commit ef3720be11
16 changed files with 717 additions and 54 deletions

View File

@@ -92,7 +92,15 @@
<version>${jackson}</version>
<optional>true</optional>
</dependency>
<!-- JSON patch -->
<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-patch</artifactId>
<version>1.7</version>
</dependency>
<!-- Test dependencies -->
<dependency>