Refactored the way the general support for an HTTP method for the resource exported. The decision is implemented in RootResourceInformation (formerly RepositoryRestRequest). Removed request specific information from that class and introduced a HandlerMethodArgumentResolver to be able to inject HttpMethod instance into controller methods (filed https://jira.springsource.org/browse/SPR-11425 to get that support into Spring Framework itself).
Generally moved away from throwing NoSuchMethodExceptions and correctly expose HttpRequestMethodNotSupportedException instead to make sure Spring MVC renders the appropriate allowed methods if possible.
Removed RepositoryInvokerHandlerMethodArgumentResolver as a RepositoryInvoker can be obtained from the RootResourceInformation where necessary.
Related pull request: #125.
Links are a read-only and basically have to be ignored during any inputs. This required removing the deserializer from PersistentEntityJackson2Module. This will cause the object mapping to fail as it doesn't know about the links property in the request body. Instead of requiring that every entity apply the necessary annotation, the mapper is configured to not fail on non-existent attributes. This allowed all the tests to pass while properly handling PUT operations.
Original pull request: #130.
CrudRepositoryInvoker now detects re-declared CRUD methods and falls back to reflection invocation if the re-declaration is detected.
Inspired by PR #126 by Nick Weedon but avoiding the introduction of a dependency to Spring Security by using a more precise testing approach.
Original pull request: #126.
ValidatingRepositoryEntityListener previous referred to a Repositories instance which causes a circular reference on initialization after some changes in Spring Data Commons Repositories.
Major cleanups in the ValidatingRepositoryEntityListener implementation.
Properties with null values properly get rendered in JSON outputs. This was fixed some time ago. Added test case to prove it.
Original pull request: #132.
Upgraded to Spring Data RC modules, Spring HATEOAS 0.9.0.RELEASE and Spring Plugin 1.0.0.RELEASE. Removed placeholder for Jackson 2 version as it's in the parent build pom now. Switched to milestone repository.
Generally polished implementation and test cases for Greg's contribution.
Re-ordered parameters in ControllerUtils' helper methods for consistency.
Use Spring's CollectionFactory to create a suitable collection for the handled properties in the first place to avoid unnecessary conversion later on.
Removed duplication in test cases. Polished JavaDoc in UriListHttpMessageConverter and moved to a Scanner based implementation to read the request body.
Adapted to latest changes in Spring HATEOAS. Reactivated ResourceStringUtilsTests.
Related pull requests: #128, #86.
This PR is inspired by #86, but had to be written from scratch because it was over 10 months old when this was undertaken. It was unmergeable.
Essentially, by casting existing collections and then iterating over them and making adjustments should render more efficient back end database operations. Only for a PUT should a new collection be created.
This PR not only updates these operations, but provides test cases to back up these edits, i.e. a test case for POSTing to a collection, PUTing to a collection, and DELETE-ing from a collection.
Adds ability to return an empty response with only the Location header populated by looking at the property update's incoming URL.
Original pull request: #128, #86.
@RepositoryRestResource exposes more detailed attributes tailored to the use case of exposing a repository. @RestResource is still recognized on repository interfaces but we now issue a warning and indicate the new annotation to be used.
Introduced a minimal ResourceDescription interface and let @Description be used within @RestResource and @RepositoryRestResource. We now generate default resource bundle keys and resolve them against a "rest-messages" resource bundle by default. JsonSchema converter now uses the rendered descriptions for schema descriptions.
If the resource exposed for a domain or repository type is considered a paging resource we now return a templated URI. Introduced ResourceMapping.isPagingResource() to allow clients to find out about whether the resource is actually capable of pagination. Adapted implementations to inspect the findAll(…) method as well as the search methods for a Pageable parameter.
Tweaked pom.xml to create correct classpaths if the IDE uses direct workspace project references.
MethodResourceMapping now exposes the parameters a query method expects. The RepositorySearchController the uses these to append the
Upgraded to Spring Data Commons 1.7.0.BUILD-SNAPSHOT.
RepositorySearchController now returns a ResourceSupport instead of a Resource as it will only return links anyway. Latest changes in Spring HATEOAS prevent Resource from being used with collection based content to prevent invalid rendering.
Due to the change in the default media type, the RepositorySearchController was totally broken as it used "produces" clauses in the request mapping. I've removed them and added test cases to make sure the search resources are exposed and are accessible.
Altered the order of HttpMessageConvertersRegistered based on the default media type being defined. This causes the legacy representation to be rendered as default representation if the default media type on RepositoryRestConfiguration is set to something different from HAL.
We're now using @EnableHypermediaSupport via a delegated class to prevent @EnableHypermediaSupport from breaking when RepositoryRestMvcConfiguration is subclassed.
The build script now declares the Jackson Hibernate 4 as optional dependency to avoid being registered in a non-Hibernate environment. Tightened auto-registration checks to also check for Hibernate 4 presence at all.
We automatically activate verbose date rendering when registering the Joda Time module.
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.
The BeanWrapper used to set and get values of entities now gets a autowired ConversionService applied. Simplified collection and map creation by using Spring API. Added test case to update an entity with an embedded collection.
Removed the attempt to add a link to the response for non-associations. Switched to the usage of Simple(Property|Association)Handlers for simplified generics.