Commit Graph

887 Commits

Author SHA1 Message Date
Oliver Gierke
1f95a3387b DATAREST-1076 - Expose constructor that takes RelProvider of RepositoryResourceMappings.
We now expose the constructor that takes a RelProvider in RepositoryResourceMappings so that clients can tweak the default relation names. Changed the order of constructor parameters of (previously) non-public constructors for consistency.

The RelProvider to be used with the mappings can now be configured via RepositoryRestConfiguration and defaults to the EvoInflector based one.
2017-05-18 14:50:50 +02:00
Oliver Gierke
0813faf0d5 DATAREST-1039 - Fix appending a complex value appended to a collection via JSON Patch.
When a PATCH call using JSON Patch tried to append an item to an empty collection, it previously failed to look up the type to unmarshal the incoming payload to. We now inspect the declared types on the wrapped object's property to determine that type for append operations.

Also, an uninitialized collection is now initialized using Spring's CollectionFactory.
2017-05-12 14:42:38 +02:00
Mark Paluch
bb8be787c9 DATAREST-1052 - Updated changelog. 2017-05-09 11:36:18 +02:00
Oliver Gierke
3b30be15c2 DATAREST-1057 - Updated changelog. 2017-04-19 21:04:22 +02:00
Oliver Gierke
707a147064 DATAREST-1056 - After release cleanups. 2017-04-19 20:01:14 +02:00
Oliver Gierke
2c1d831c62 DATAREST-1056 - Prepare next development iteration. 2017-04-19 20:01:13 +02:00
Oliver Gierke
ea2c13ac45 DATAREST-1056 - Release version 2.6.3 (Ingalls SR3). 2017-04-19 19:32:39 +02:00
Oliver Gierke
eaec427fa9 DATAREST-1056 - Prepare 2.6.3 (Ingalls SR3). 2017-04-19 19:32:01 +02:00
Oliver Gierke
709128f54f DATAREST-1056 - Updated changelog. 2017-04-19 19:31:57 +02:00
Oliver Gierke
0d638a3e7c DATAREST-1017 - Updated changelog. 2017-04-19 13:04:11 +02:00
Oliver Gierke
3d73062d37 DATAREST-1016 - After release cleanups. 2017-04-19 11:48:46 +02:00
Oliver Gierke
1f8857be95 DATAREST-1016 - Prepare next development iteration. 2017-04-19 11:48:43 +02:00
Oliver Gierke
41130ec142 DATAREST-1016 - Release version 2.6.2 (Ingalls SR2). 2017-04-19 10:11:29 +02:00
Oliver Gierke
77a89d346b DATAREST-1016 - Prepare 2.6.2 (Ingalls SR2). 2017-04-19 10:10:48 +02:00
Oliver Gierke
cced2a322e DATAREST-1016 - Updated changelog. 2017-04-19 10:10:43 +02:00
Mark Paluch
ef508ed6dc DATAREST-1019 - Consider base URI when resolving cross-origin configuration on repositories.
We now consider the base URI when resolving CORS configuration from repository interfaces. The base URI is now stripped from the request. Previously the base URI was not stripped from the request and was used to determine an exported resource.
2017-04-18 19:35:06 +02:00
Michael J. Simons
4a75efcad1 DATAREST-1046 - Fix instructions how to manually add a validator.
Original pull request: #264.
2017-04-11 10:22:13 +02:00
Oliver Gierke
2b63e4bcdb DATAREST-1050 - PUT for create now makes sure the resource id is set on the instance to create.
So far, we handed the plain instance deserialized from the request body to the repository to persist it. That caused issues in PUT for create scenarios where the URI contains the identifier to be used for the aggregate to create and identifier generation being used in the backend. In that case the identifier submitted was never considered and subsequent requests would've created new instances, effectively breaking the idempotent nature of PUT.

We now make sure the backend identifier derived from the resource is set on the aggregate instance about to be created, so that backend can either accept that situation (new entity + manually defined identifier) or reject it (in case it insists on identifier generation).
2017-04-11 08:26:47 +02:00
Oliver Gierke
4354d35c9c DATAREST-1030 - Reinstantiate PATCH behaviour for associations.
We now completely opt out of merging values if the property is a linkable association.
2017-04-10 19:08:16 +02:00
Oliver Gierke
ccfe96de48 DATAREST-946 - Updated changelog. 2017-04-10 14:07:11 +02:00
Mark Paluch
aa5e816f08 DATAREST-1020 - Mention correct method in reference docs to configure global CORS mappings.
Point in reference documentation to `addMapping(…)` instead of `addCorsMapping(…)`.
2017-03-08 11:20:20 +01:00
Oliver Gierke
a2d11011da DATAREST-1018 - Prevent NullPointerException in UriToEntityConverter.
In case PersistentEntities exposes a managed type whose raw type currently doesn't have a PersistentEntity registered, the constructor of UriToEntityConverter ran into a NullPointerException.

We now explicitly check for null and skip those types.

Filed DATAREST-1021 for further improvements in the 3.0 time frame.
2017-03-07 14:50:30 +01:00
Oliver Gierke
6367af2f84 DATAREST-1014 - Avoid Java 8 API usage in AnnotatedEventHandlerInvoker.
Dropped the call to Method.getParameterCount() in favor of ….getParameterTypes().length as the former method was introduced in Java 8.
2017-03-03 11:39:30 +01:00
Oliver Gierke
544f785c55 DATAREST-989 - Updated changelog. 2017-03-02 16:57:52 +01:00
Oliver Gierke
7546f8b51e DATAREST-990 - After release cleanups. 2017-03-02 10:21:55 +01:00
Oliver Gierke
f6708109ca DATAREST-990 - Prepare next development iteration. 2017-03-02 10:21:39 +01:00
Oliver Gierke
d75254d1ac DATAREST-990 - Release version 2.6.1 (Ingalls SR1). 2017-03-02 09:41:28 +01:00
Oliver Gierke
794d59463c DATAREST-990 - Prepare 2.6.1 (Ingalls SR1). 2017-03-02 09:33:29 +01:00
Oliver Gierke
56fdd2d1b3 DATAREST-990 - Updated changelog. 2017-03-02 09:33:01 +01:00
Oliver Gierke
941408daff DATAREST-1003 - Entity resources don't answer arbitrary JSON requests.
Previously, when a request was sending an Accept header of some arbitrary *+json, the request was routed through the controllers and might have ended up producing a PersistentEntityResource that was then mapped using an uncustomized Jackson ObjectMapper. That has caused a huge JSON object to be unfolded which is highly undesirable.

We now only answer JSON requests to repository resources that contain an Accept header with any of the explicit JSON media types we got registered.

Tweaked the setup of the ExceptionHandlerExceptionResolver to not expose a bean in the first place but rather use the Spring MVC provided callbacks to register custom ones. We also now make sure MVC is bootstrapped property for integration tests through the inclusion of DelegatingWebMvcConfiguration.
2017-03-01 21:30:37 +01:00
Oliver Gierke
f4b8ee3be2 DATAREST-995 - Fixed detection of collection append operations for JSON Patch requests.
We previously erroneously looked for a ~ in a JSON Pointer to indicate collection append in e.g. an add operation. We now also support the actually correct - keeping the original behavior for now to not break clients that currently make use of it.
2017-02-08 20:00:03 +01:00
Jens Schauder
e94ba4a1fa DATAREST-994 - Fixed two argument constructor of RepositoryRestHandlerMapping.
Repositories in RepositoryCorsConfigurationAccessor may be null now. findCorsConfiguration returns null when no repositories are provided.

Original pull request: #257.
2017-02-03 09:06:59 +01:00
Mark Paluch
d2386dc64e DATAREST-992 - Remove references to Assert single-arg methods.
Replace references to Assert single-arg methods with references to methods accepting the test object and message.

Related ticket: SPR-15196.
2017-02-01 13:23:59 +01:00
Oliver Gierke
d8dcef1de9 DATAREST-966 - Updated changelog. 2017-01-26 12:08:53 +01:00
Oliver Gierke
d8698f404d DATAREST-967 - After release cleanups. 2017-01-26 10:57:48 +01:00
Oliver Gierke
17d08d2830 DATAREST-967 - Prepare next development iteration. 2017-01-26 10:57:45 +01:00
Oliver Gierke
93a2c589c5 DATAREST-967 - Release version 2.6 GA (Ingalls). 2017-01-26 10:27:10 +01:00
Oliver Gierke
18df680b0f DATAREST-967 - Prepare 2.6 GA (Ingalls). 2017-01-26 10:26:35 +01:00
Oliver Gierke
b458af18a8 DATAREST-967 - Updated changelog. 2017-01-26 10:26:33 +01:00
Oliver Gierke
fe75811812 DATAREST-944 - DomainObjectMerger now also merges associations for PUT.
We now explicitly merge associations skipping the linkable ones. We also try to reuse the existing collections and maps if they're mutable falling back to a completely new one if not.

Extracted PropertyHandler and AssociationHandler implementations.
2017-01-26 07:39:54 +01:00
Oliver Gierke
5494f1f6a5 DATAREST-983 - AnnotatedEventHandlerInvoker now resolves generic handler method argument.
We now resolve the handler method argument type of an annotated repository event handler against the concrete handler type to make sure generics are resolved properly.
2017-01-24 16:57:35 +01:00
Oliver Gierke
8e1af29bf2 DATAREST-977 - Fixed reading of complex enums on collection expansion for PATCH.
When merging collections on PATCH we now don't use the first collection item's type for all elements but inspect the values for each existing element found. When it comes to appending elements to the collection, wen now just stick to the declared component type as type hint for reading the provided value.
2017-01-24 16:10:37 +01:00
Oliver Gierke
2738982576 DATAREST-957 - Improved PUT handling for transient properties not backed by a field.
When copying the transient properties of an aggregate, we now try field based access first and fall back to accessor based copying in case both a setter and getter are exposed on the type.

Previously we always expected a field to be present which doesn't necessarily has to be the case.

Related ticket: DATAREST-986.
2017-01-24 13:21:47 +01:00
Oliver Gierke
132807cbf1 DATAREST-965 - Switched to property based application of PUT requests.
Jacksons ObjectMapper.readerForUpdate(…) unfortunately doesn't handle nested objects properly. We already have a manual merge process in place for PATCH requests but tweaking that to also handle PUT requests gracefully caused more complexity than anticipated.

We now switched to an object based merge so that we can read in the source JSON structure into a new object and then merge the objects.

Related pull request: #247.
2017-01-23 15:34:52 +01:00
Oliver Gierke
294db99e63 DATAREST-986 - DomainObjectReader now merges complex nested maps correctly.
We now use a Map property's generic type information to make sure we convert both the key and the value into the declared types. Previously we just used Object if the source value to map was null. Object is still used as fallback for raw maps though.
2017-01-23 09:24:14 +01:00
Oliver Gierke
6a3a7131ac DATAREST-970 - AnnotationEventHandlerInvoker now considers order of event handler methods.
We now make sure that an @Order annotation on annotated event handler methods are considered and the methods are invoked in the defined order.

Non-annotation-based event handlers don't suffer from the same problem as they're ApplicationListener instances directly so that the container will enforce the correct ordering in case @Order is used or Ordered is implemented.

Some cleanup in EventHandlerMethod.

Original pull request: #248.
2017-01-19 15:05:43 +01:00
Oliver Gierke
99f49532b6 DATAREST-976 - Polishing.
Extracted test for the newly supported sorting scenario so that we now.

Original pull request: #251.
2017-01-16 13:31:45 +01:00
Mark Paluch
ffe96e4079 DATAREST-976 - Embedded properties are now considered in sort property paths.
We now allow sorting by properties of embedded objects. An embedded object is not linkable to a root object but embedded in the resource itself. If any part of the sort property path points to a linkable association, the whole sort property path is discarded silently and not used for sorting any further.

Original pull request: #251.
2017-01-16 13:30:30 +01:00
Mark Paluch
629ca4e33d DATAREST-979 - Update project documentation with the CLA tool integration. 2017-01-13 11:56:15 +01:00
Mark Paluch
4837ba83b1 DATAREST-978 - Polishing.
Convert @see http://… links to valid format using @see <a href=…>…</a>.
2017-01-13 10:09:17 +01:00