Commit Graph

584 Commits

Author SHA1 Message Date
Oliver Drotbohm
a9576991fe DATAREST-1535 - Adapt to changes in Spring Framework 5.3.
We now implement getPatternParser() in DelegatingHandlerMapping introduced in Spring 5.3. Adapt to changes in CORS handling.
2020-06-24 23:52:45 +02:00
Mark Paluch
ef7617cb6f DATAREST-1509 - Polishing.
Reduce Jenkins build to Java 8 + 14 for jackson-next profile. Simplify assertion style. Convert space indents to tabs.

Original pull request: #374.
2020-04-28 11:01:00 +02:00
Greg Turnquist
eaa70cdc77 DATAREST-1509 - Test against all ISO-8601 TZ formats.
Verify that Jackson properly serializes to ISO-8601 format, which includes three potential timezone endings. Expand CI testing against both Jackson 2.10 and 2.11. Also test these profiles against JDK 8, 11, and 14.

Related: spring-projects/spring-data-build#1075
Original pull request: #374.
2020-04-28 11:00:53 +02:00
Oliver Drotbohm
7c10768501 DATAREST-1513 - Avoid superflous instantiations of EmbeddedResourcesAssembler. 2020-04-28 00:31:29 +02:00
Oliver Drotbohm
399c846378 DATAREST-1479 - Patching collections now also works for nested collections.
We now properly use the PropertyPath's leaf property to check whether we need to deal with a collection in JSON Patch pointers.
2020-04-27 23:52:55 +02:00
Oliver Drotbohm
db5995eee0 DATAREST-762 - Collection resource's base link now forwards parameters.
We now use the current request's URI as base link for all links created for a collection resource. This especially has effect in the creation of pagination links as we now carry potentially applied critierias (induced by our Querydsl based filtering support) forward to the navigation links generated.
2020-03-30 22:50:21 +02:00
Oliver Drotbohm
4c17d54e9a DATAREST-1499, DATAREST-1500 - Cleanups.
Moved off Spring Framework deprecations for HttpMessageNotReadableException. This required some rearrangements of method signatures for types (hopefully) exclusively used by internal abstractions (some public, but not very friendly for user extension in the first place).

Switched to consistent use of Pageable.unpaged() instead of null. Switched to the use of new factory methods in Spring HATEOAS. Some Java 8 based improvements in request handling to simplify the implementation code. Deprecation of code that got obsolete due to the use of the factory methods.

Moved off some deprecations in Jackson APIs.

Removed a couple of unused imports. General avoidance of common warnings. Suppression where needed. Removed dead code in configuration.
2020-03-27 14:16:47 +01:00
Mark Paluch
abedcd130a DATAREST-1491 - Adapt to Mockito 3.3 changes. 2020-03-11 09:34:57 +01:00
Thomas Mrozinski
07039a2838 DATAREST-1068 - Resize array during merge.
When merging new data into a PersistentEntity, JsonNodes of array types were deserialized into immutable Lists, but the list is later mutated if the source and target arrays are of different sizes. This commit ensures that an array is deserialized into a mutable list.

Original pull request: #371.
2020-02-26 09:59:21 +01:00
Oliver Drotbohm
d8c3394cd7 DATAREST-1470 - Switched to use factory methods of RepresentationModel types. 2020-01-14 14:51:18 +01:00
Mark Paluch
88f49da22f DATAREST-1467 - Update copyright years to 2020. 2020-01-07 09:02:59 +01:00
Oliver Drotbohm
2b8e7afbf3 DATAREST-1463 - Adapt to API changes in LinkBuilderSupport. 2019-12-09 10:21:13 +01:00
Oliver Drotbohm
9010a9d132 DATAREST-1458 - Fixed rendering of compact view to association resources.
The usage of text/uri-list as media type was entirely broken and not even advertised in the reference docs anymore. It's now again supported for both to-one and to-many associations via Collections. Maps are rejected as they cannot be rendered as list of URIs correctly. Updated reference documentation accordingly.

Added a custom MapModel implementation of RepresentationModel as apparently using Maps with EntityModel does not unwrap the content properly due to [0].

[0] https://github.com/FasterXML/jackson-databind/issues/171
2019-11-29 17:17:35 +01:00
Oliver Drotbohm
28f8e0d397 DATAREST-1440 - Revisited removal of fields in incoming payloads.
We now only remove fields from the payload in case there's no @JsonAnySetter on the target entity.
2019-11-04 09:09:59 +01:00
Oliver Drotbohm
8689c1bb5b DATAREST-1446 - Polishing.
Test cases.

Original pull request: #366.
2019-10-28 15:00:54 +01:00
Javier Grande Pérez
694079df04 DATAREST-1446 - DefaultExcerptProjector now declines presence of projection if metadata returns Optional.empty().
If no excerpt projection is exposed by the underlying ResourceMetadata, DefaultExcerptProjector now also properly declines its existence in ….hasExcerptProjection(…). Previously, it always indicated a presence as it improperly used a null check rather than calling Optional.isPresent().

Original pull request: #366.
2019-10-28 14:57:57 +01:00
Ľubomír Varga
202a8aa302 DATAREST-1356 - Fix updating single associations.
Correct a regression regarding association links. Introduce several test cases to prove this situation is fixed regarding PUTs for association links.

Source of the bug: 554d6cb27b (diff-1d7c16fe1992fef13a47fa8ab8599718L317) flips the criteria from "not single" to "single" without checking for related impacts.
2019-10-21 13:02:45 -05:00
Oliver Drotbohm
384e0ed0cd DATAREST-1427 - Fixed handling of unpaged Pageable values. 2019-09-25 14:27:00 +02:00
Greg Turnquist
0b0ffab46b DATAREST-1421 - Polishing. 2019-08-08 10:54:53 -05:00
Greg Turnquist
9c56c3f217 DATAREST-1421 - Deprecate ALPS_JSON and ALPS_JSON_VALUE.
Instead, use Spring HATEAOS's MediaTypes.ALPS_JSON and ALPS_JSON_VALUE.
2019-08-08 10:54:45 -05:00
Oliver Drotbohm
244c57f712 DATAREST-1414 - Use I18N facilities of Spring HATEOAS more intensively.
We now rely on the MessageResolver capabilities of Spring HATEOAS to benefit of the optimizations in resource bundle resolution. Tweaked a couple of tests to make sure they properly use the resolver resorting to the default message the MessageResourceResolvable exposes.
2019-07-31 18:19:00 +02:00
Mark Paluch
19c261d7d0 DATAREST-1410 - Migrate remaining tests to AssertJ. 2019-07-31 10:06:03 +02:00
Oliver Drotbohm
556e918ef7 DATAREST-1403 - CollectionResourceMapping.getExcerptProjection() now returns Optional. 2019-06-26 17:46:43 +02:00
Oliver Drotbohm
d7b66777da DATAREST-1393 - Introduce workaround for Jackson property customization bug.
Deserializer customizations for related resources (deserializing an instance from a URI) are not applied to the creator properties Jackson uses to create an entity instance in the first place (see [0] for details). We work around this now by tweaking the property instances used for that in their origin ValueInstantiator via reflection until the bug gets fixed.

[0] https://github.com/FasterXML/jackson-databind/issues/2367
2019-06-25 16:00:39 +02:00
Oliver Drotbohm
788422f3eb DATAREST-1397 - Polishing.
Removed the redeclaration of hasCorsConfigurationSource(…) in RepositoryRestHandlerMapping as it already inherits the one from BasePathAwareRestHandlerMapping.
2019-06-21 15:40:07 +02:00
Mark Paluch
5eba301d62 DATAREST-1397 - Adapt to CORS changes in AbstractHandlerMapping.
We now enable CORS handling for all requests by overriding the newly introduced hasCorsConfigurationSource method. We cannot detect CORS configuration handling solely on the handler but require path headers to resolve repository interface mappings.
2019-06-21 15:40:07 +02:00
Mark Paluch
9f7c82e2c8 DATAREST-1398 - Integrate nohttp tooling into CI build profile. 2019-06-18 10:10:00 +02:00
Oliver Drotbohm
7ea19bdc5b DATAREST-1394 - Upgrade to Spring Plugin 2.0 M2. 2019-06-14 01:48:21 +02:00
Oliver Drotbohm
b84aa1779c DATAREST-1390 - Remove temporary workaround after upgrade to Spring 5.2 M3.
This reverts commit 8ce25f7918.
2019-06-14 01:40:48 +02:00
Oliver Drotbohm
8ce25f7918 DATAREST-1390 - Temporary workaround for regression in Spring 5.2 snapshots. 2019-06-06 13:49:15 +02:00
Oliver Drotbohm
a506520c80 DATAREST-1388 - RepositoryRestMvcConfiguration now reuses RepresentationModelProcessorInvoker from Spring HATEOAS. 2019-06-05 23:47:36 +02:00
Oliver Drotbohm
ac72c8c91e DATAREST-1387 - DelegatingHandlerMapping now handles HttpMediaTypeNotSupportedException. 2019-06-05 23:38:35 +02:00
Oliver Drotbohm
e744c1c94f DATAREST-1386 - Add HAL Explorer module
We now ship a module containing the HAL Explorer [0] as an alternative to the HAL Browser which seems to be mostly out of maintenance and the WebJar refers to a jQuery version with a CVE. The new module still contains some customization code that we had in place for the browser to customize the POST/PUT forms to use the JSON Schema exposed for the aggregates.

The HAL Browser extension is now deprecated in the form that its inclusion causes a warn log to recommend switching to the explorer. A couple of general coding improvements: package scope for controllers and handler methods. Better use of constants and newer request mapping annotations.

Tweaked the configuration of static resource handlers to resolve the implicit cyclic dependency between the browser/explorer and the WebMVC module by introducing a Spring Factories backed extension SPI.

[0] https://github.com/toedter/hal-explorer
2019-06-05 11:54:19 +02:00
Mark Paluch
49605b2b1a DATAREST-1351 - URL Cleanup. 2019-06-05 11:30:39 +02:00
Oliver Drotbohm
3c635c3c81 DATAREST-1382 - Avoid to call BackendIdConverter if no id used for the request mapping.
Contrary to what's stated in the Javadoc of BackendIdConverter, BackendIdConverterHandlerMethodArgumentResolver now skips the invocation of ….fromRequestId(…) if no identifier path variable is found for the mapping of the method invoked.
2019-06-04 23:51:31 +02:00
Oliver Drotbohm
8b9ed0ca07 DATAREST-1381 - Polishing. 2019-06-04 23:51:31 +02:00
Oliver Drotbohm
d80070acb9 DATAREST-1381 - Improve documentation around @RepositoryRestController. 2019-06-04 23:51:31 +02:00
Oliver Drotbohm
928faa7f9a DATAREST-1383 - Polishing.
Avoid repeated lookups of PersistentPropertyAccessor in DomainObjectReader for PATCH requests. Formatting.
2019-05-28 17:37:33 +02:00
Oliver Drotbohm
28787116a6 DATAREST-1383 - PATCH requests now skip application of values for backend read-only properties.
MappedProperties now immediately drops non-writable properties when created for deserialization. Previously those properties would have to be annotated with @JsonProperty(access = Access.READ_ONLY) explicitly to avoid them being considered.
2019-05-28 17:37:33 +02:00
Oliver Drotbohm
82b928848b DATAREST-1373 - Upgrade to API changes in Spring HATEOAS 1.0 M2. 2019-05-08 19:49:58 +02:00
Spring Operator
3a0cba94a2 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 395 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: #352
2019-03-22 10:51:57 +01:00
Oliver Drotbohm
5f41d6664e DATAREST-1354 - Polishing. 2019-03-20 17:28:00 +01:00
Oliver Drotbohm
0900517e04 DATAREST-1354 - Avoid exceptions for missing enum value translations.
We now use a dedicated implementation of MessageSourceResolvable to avoid missing enum value translations actually causing exceptions. That also allows us to defer the calculation of the default (potentially translated in a default way).
2019-03-20 17:28:00 +01:00
Oliver Drotbohm
dc10166679 DATAREST-1304 - EntityLookupConfiguration is now used in PUT for creation.
Previously the backend identifier derived from the URI was set as identifier on the object to be created in a PUT request. However, in case a custom entity lookup is used, this is not the identifier but an arbitrary property pointed to through user defined code, mostly a method reference.

We now use the newly introduced MethodInvocationRecorder API in Spring Data Commons to be able to obtain the property that is supposed to be used and set that to the value calculated. This requires the entity type for which the custom lookup is configured to be non-final as the invocation recording is build on top of proxies.

Related tickets: DATACMNS-1449.
2019-03-06 14:34:58 +01:00
Jeroen Reijn
6d0acfd997 DATAREST-1143 - Prefer ResourceNotFoundException over ResponseEntity.notFound().
This is to allow users to plug in custom exception handling to control these situations.

Original pull request: #284.
2019-03-05 15:46:05 +01:00
Oliver Drotbohm
017b69c4e1 DATAREST-1338 - JsonPatch handling is now able to traverse maps.
We're now able to correctly identify Map keys within JsonPatch paths so that e.g. people/Dave/name properly translates into a people['Dave'].name SpEL expression.

Streamlined the design of SpelPath to avoid duplicate parsing and properly express the difference between typed and untyped paths in the type hierarchy. Slightly refactored the type hierarchy so that only methods that make sense in either untyped or typed state appear on the instance returned (getLeafType(Class) was exposed on TypedSpelPath before, which was confusing).
2019-03-05 13:54:58 +01:00
Oliver Drotbohm
d714d10675 DATAREST-1341 - Upgrade to latest API changes in Spring HATEOAS. 2019-03-04 11:42:58 +01:00
Oliver Drotbohm
1bf08180db DATAREST-1341 - Adapt to package refactorings in Spring HATEOAS. 2019-02-27 20:31:59 +01:00
Oliver Drotbohm
85694576b2 DATAREST-1341 - Adapt RepositoryLinkBuilder to API changes in Spring HATEOAS.
Removed obsolete BaseUriLinkBuilder as well.
2019-02-22 18:33:50 +01:00
Oliver Drotbohm
554d6cb27b DATAREST-1341 - Further API adaption for Spring HATEOAS 1.0. 2019-02-15 11:10:59 +01:00