534 Commits

Author SHA1 Message Date
Spring Operator
e1440b1095 DATAREST-1351 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 374 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0.html with 1 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0.html ([https](https://www.apache.org/licenses/LICENSE-2.0.html) result 200).

Original Pull Request: #332
2019-03-22 10:25:26 +01:00
Spring Operator
fc7c7695f8 DATAREST-1351 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://maven.apache.org/xsd/maven-4.0.0.xsd with 13 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).
* http://www.pivotal.io with 2 occurrences migrated to:
  https://www.pivotal.io ([https](https://www.pivotal.io) result 301).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0 with 26 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 13 occurrences

Original pull request: #309
2019-03-18 11:48:26 -05:00
Oliver Gierke
f5bfe53588 DATAREST-1127 - Patch operations now always verify paths before operation application.
Previously, the SpEL expression created from JSON Patch path expressions were executed without double checking whether these paths actually exist on the target object in the first place. This check is now in place.
2017-09-08 12:00:51 +02:00
Oliver Gierke
291e8210c5 DATAREST-1060 - Improve AssociationOmittingSerializerModifier to not break on Jackson 2.9.
According to this upstream ticket [0] we need to override BeanSerializerModifier.changeProperties(…) rather than ….updateBuilder(…). The commit just does that.

[0] https://github.com/FasterXML/jackson-databind/issues/1664

Related ticket: FasterXML/jackson-databind#1664
2017-06-19 17:39:30 +02:00
Oliver Gierke
9b4fbcef96 DATAREST-1092 - Improve exception handling in PatchOperation for Spring 5 compatibility.
We now also catch SpelEvaluationException in the attempt to set a null value for an expression as Spring 5 now reports a failed attempt (e.g. if the target type is not nullable) using that type whereas Spring 4.3 threw a NullPointerException.
2017-06-14 11:30:50 +02:00
Oliver Gierke
a0bd7e79f0 DATAREST-1031 - Fixed setup of ExceptionHandlerExceptionResolver.
Fixed the setup of our custom ExceptionHandlerExceptionResolver to conclude with a call to afterPropertiesSet() to make sure it's properly initialized.
2017-06-09 09:58:41 +02:00
Mark Paluch
f136fd4f31 DATAREST-1058 - Prepare next development iteration. 2017-06-07 11:50:56 +02:00
Mark Paluch
e64f9e944a DATAREST-1058 - Release version 2.5.11 (Hopper SR11). 2017-06-07 11:11:08 +02:00
Oliver Gierke
9ee2d43bae 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:45:55 +02:00
Oliver Gierke
4ecb007adf DATAREST-1057 - Prepare next development iteration. 2017-04-19 21:02:14 +02:00
Oliver Gierke
f56485d92d DATAREST-1057 - Release version 2.5.10 (Hopper SR10). 2017-04-19 20:36:43 +02:00
Oliver Gierke
007a1ff582 DATAREST-1017 - Prepare next development iteration. 2017-04-19 13:01:02 +02:00
Oliver Gierke
ebc925804e DATAREST-1017 - Release version 2.5.9 (Hopper SR9). 2017-04-19 12:38:29 +02:00
Oliver Gierke
1abaab5ee8 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:53 +02:00
Oliver Gierke
cef2811a32 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:10:03 +02:00
Oliver Gierke
82e2cceecf DATAREST-989 - Prepare next development iteration. 2017-03-02 12:05:55 +01:00
Oliver Gierke
f92169d7fb DATAREST-989 - Release version 2.5.8 (Hopper SR8). 2017-03-02 11:30:05 +01:00
Oliver Gierke
59b2243864 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.

We also now make sure MVC is bootstrapped property for integration tests through the inclusion of DelegatingWebMvcConfiguration.
2017-03-01 21:37:00 +01:00
Oliver Gierke
9a1dafdd24 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:01:54 +01:00
Mark Paluch
6bbf228bb1 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:24:53 +01:00
Oliver Gierke
1eff4ba0bd DATAREST-966 - Prepare next development iteration. 2017-01-26 12:04:55 +01:00
Oliver Gierke
5a1b58911f DATAREST-966 - Release version 2.5.7 (Hopper SR7). 2017-01-26 11:33:51 +01:00
Oliver Gierke
20f1357ced 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:42:45 +01:00
Oliver Gierke
d575c37c7b DATAREST-944 - Moved MappedProperties to separate class.
This should ease backports from upstream branches.
2017-01-26 07:42:35 +01:00
Oliver Gierke
e9526f25cf 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:09:53 +01:00
Oliver Gierke
86af638668 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:58 +01:00
Oliver Gierke
e7077cdb38 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 16:19:19 +01:00
Oliver Gierke
1bcd717aa8 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:30:42 +01:00
Oliver Gierke
5a5d6d73ce DATAREST-932 - Prepare next development iteration. 2016-12-21 19:33:41 +01:00
Oliver Gierke
134ef39544 DATAREST-932 - Release version 2.5.6 (Hopper SR6). 2016-12-21 19:04:46 +01:00
Oliver Gierke
ee1ac227d4 DATAREST-959 - Polishing.
Skip all merge logic if the source value is null. That frees all nested logic from handling with that case and us falling back to plain Jackson reading.

The array handling now also opts out if the source value is not a collection or array in the first place as it means we need to let Jackson override the value with the collection given to be deserialized.

Original pull request: #246.
2016-12-13 10:09:12 +01:00
Milos Cubrilo
0cd5a3af69 DATAREST-959 - Fix adding elements to empty array in DomainObjectReader.
Original pull request: #246.
2016-12-13 10:09:09 +01:00
Oliver Gierke
c92968ac8f DATAREST-957 - Polish most critical Sonar warnings.
Fixed broken equals(…) in ProjectionDefinition. Switched to iterating over Map's entry set instead of the keys. Made UriAwareHttpServletRequest static.
2016-12-08 10:12:23 +01:00
Oliver Gierke
da691726e8 DATAREST-956 - Polishing.
Some tiny refactorings in DomainObjectReader. We're now using TypeInformation instead of Class to preserve more generics information when it comes to deeper nesting.

Moved some code around in the unit tests.

Original pull request: #245.
2016-12-08 09:48:13 +01:00
Mathias Düsterhöft
9c6606b217 DATAREST-956 - Fixed handling of collection element addition and removal for PUT requests.
DomainObjectMerger now properly adds and removes elements to and from collections.

Original pull request: #245.
2016-12-08 09:48:13 +01:00
Oliver Gierke
9f2332811d DATAREST-953 - Added test case to verify this is fixed.
Seems the change for DATAREST-938 has also fixed this one. Added a test case similar to what was provided in the example for the original ticket.
2016-12-07 18:47:52 +01:00
Oliver Gierke
10536bf3b5 DATAREST-938 - Polishing.
Formatting and author.

Original pull request: #241.
2016-12-07 18:47:48 +01:00
Craig Andrews
a1c85cd82d DATAREST-938 - Update nested entities instead of replacing them with new instances.
Original pull request: #241.
2016-12-07 18:47:17 +01:00
Oliver Gierke
f76e5a4420 DATAREST-937 - Polishing.
Moved the newly added test case to the end of the list. Formatting.

Original pull request: #240.
2016-12-06 09:38:04 +01:00
Craig Andrews
17fbdbb8a2 DATAREST-937 - Transient properties in JSON are now included in merge.
We now don't prematurely drop fields that don't have a persistent property exposed in DomainObjectReader. Doing so dropped values for transient fields as the latter are not exposed as persistent property in the first place. We still skip any nested merging though.

Original pull request: #240.
2016-12-06 09:38:04 +01:00
Oliver Gierke
4c97011b2d DATAREST-915 - Prepare next development iteration. 2016-11-03 18:20:10 +01:00
Oliver Gierke
6d20ab6df5 DATAREST-915 - Release version 2.5.5 (Hopper SR5). 2016-11-03 17:56:32 +01:00
Oliver Gierke
316cfb1f4a DATAREST-919 - Merging of nested maps for PUT/PATCH requests now handles nested arrays and simple types. 2016-11-03 16:19:55 +01:00
Oliver Gierke
67d6a1aa16 DATAREST-931 - DomainObjectMerger now handles arrays with complex objects correctly.
We now explicitly manually merge array nodes that contain complex objects. Previously arrays would've been skipped and the subsequent Jackson update would wipe out all properties not contained in the original document even on PATCH requests.
2016-11-02 13:44:29 +01:00
Oliver Gierke
dc99347ce9 DATAREST-929 - Polishing.
Some formatting.
2016-10-26 11:54:18 +02:00
Oliver Gierke
6de70c60fe DATAREST-929 - EnumTranslatingDeserializers now handles container types correctly.
When translating enumerations, we now inspect the property and use a container type's value type as translation target.
2016-10-26 11:54:18 +02:00
Oliver Gierke
6d1dc36fed DATAREST-575 - Fixed property lookup in MappedProperties.
Previously, MappedProperties didn't handle Jackson properties correctly, that do not expose a PersistentProperty, e.g. transient ones. That led to potential nullPointerExceptions in clients as the guarding hasPersistentPropertyForField(…) still answered true, as the backing cache contained an entry with a null value. We now skip those properties completely.
2016-10-23 20:51:22 +02:00
Oliver Gierke
7b357db535 DATAREST-903 - Prepare next development iteration. 2016-09-29 14:20:09 +02:00
Oliver Gierke
e09b22bf94 DATAREST-903 - Release version 2.5.4 (Hopper SR4). 2016-09-29 13:54:03 +02:00
Mark Paluch
0a49b099bb DATAREST-909 - Revert Jackson-aware Sort and Pageable translation.
Revert changes introduced by DATAREST-883 - Jackson-aware field translation in Sort and DATAREST-906 - Consider default pageable if Sort is null. The way how Sort translation was implemented breaks Sort and Pageable argument resolution for custom controllers as a domain type is always required. Argument resolution fails if the related domain type cannot be resolved.

 Related pull requests: #231, #222.
2016-09-27 09:12:16 +02:00