DATAREST-203, DATAREST-75 - Initial support for HAL.

This commit introduces support for HAL rendering and making it the default rendering option. The configuration now registers an additional MappingJackson2HttpMessageConverter with the according HAL modules registered and makes this the default JSON renderer if the default media type is configured to HAL (which it is by default). To change this, set RepositoryRestConfiguration.setDefaultMediaType(…) back to application/json.

Refactored the PersistentEntityJackson2Module to turn the PersistentEntityResource into it's correct shape (turning associations into links) and the delegate to the default rendering, so that the HAL customizations provided by Spring HATEOAS can kick in. Adapted test cases to the change in default representation format.


Upgraded to Jackson 2.3.0, Spring 3.2.6 and Spring HATEOAS 0.9.0.BUILD-SNAPSHOT. Upgraded to Gradle 1.10.
This commit is contained in:
Oliver Gierke
2013-12-19 14:44:45 +01:00
parent 44420d862c
commit af520871dc
16 changed files with 271 additions and 102 deletions

View File

@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
@@ -36,7 +37,7 @@ public class RepositoryRestConfiguration {
private String pageParamName = "page";
private String limitParamName = "limit";
private String sortParamName = "sort";
private MediaType defaultMediaType = MediaType.APPLICATION_JSON;
private MediaType defaultMediaType = MediaTypes.HAL_JSON;
private boolean returnBodyOnCreate = false;
private boolean returnBodyOnUpdate = false;
private List<Class<?>> exposeIdsFor = new ArrayList<Class<?>>();