Commit Graph

575 Commits

Author SHA1 Message Date
Oliver Gierke
08bb44133a DATAREST-523 - Re-enabled POST for collection based association resources.
We now support augmenting elements of a collection resource by using POST which previously only worked with PATCH requests. Took the chance to clean up RepositoryPropertyReferenceController by quite a bit and refactor functionality to discover the supported HTTP methods for a PersistentProperty into RootResourceInformation.
2015-05-19 15:36:31 +02:00
Greg Turnquist
7e2752ec95 DATAREST-503 - Fix typo in reference docs
Mispelled word in SDR's reference documentation. Patched.

Courtesy of https://github.com/spring-projects/spring-data-rest/pull/172
2015-05-19 15:11:01 +02:00
Andy Wilkinson
11c8220377 DATAREST-538 - Expose Jackson converter beans as being TypeConstrained…Converters.
Previously, RepositoryRestMvcConfiguration exposed its two ResourceSupportHttpMessageConverter beans as MappingJackson2HttpMessageConverters. This made it impossible for Spring Boot support for conditional beans to identify that they were type-constrained and, therefore, were not a suitable replacement for a general-purpose Mapping Jackson2HttpMessageConverter bean.

This commit updates RepositoryRestMvcConfiguration to expose both of its Jackson message converters as TypeConstrinaedMappingJackson2HttpMessageConverter instances. This will also Spring Boot to identify that their converters are type-constrained so that it can continue to auto-configure its general purpose converter. This is important as it allows Boot to provide a converter that honors the user’s configuration rather than Spring MVC’s default converter which does not. See spring-projects/spring-boot#2914 for details.

Original pull request: #174.
2015-05-14 17:21:12 +02:00
Oliver Gierke
aecc0aa26a DATAREST-537 - Fixed removing array elements in JSON Patch operations.
Before replacing the remove operation with a custom one that nulls out the object, we check whether the JSON Pointer points to an array element. If that's the case we skip the replacement and proceed.
2015-05-09 16:43:45 +02:00
Oliver Gierke
f05a6baf11 DATAREST-531 - JSON Schema now exposes read-only fields.
Properties considered read-only are now explicitly marked as such in the JSON Schema output we render.

Related tickets: DATAREST-530.
2015-05-07 19:19:31 +02:00
Oliver Gierke
9cc609af97 DATAREST-522 - Improved exception handling in DelegatingHandlerMapping.
We now also handle HttpRequestMethodNotSupportedException and UnsatisfiedServletRequestParameterException and traverse the chain before eventually rejecting the mapping attempt with the last exception found.

Related tickets: DATAREST-409.
2015-04-17 14:52:24 +02:00
Oliver Gierke
bc04809bcf DATAREST-519 - RepositoryEntityLinks now adds existing Pageable and Sort. 2015-04-14 22:23:12 +02:00
Oliver Gierke
28e0ef76d1 DATAREST-516 - Fixed link to ALPS representation descriptors of associations.
Previously the link pointing to representation descriptors of associations neither pointed to the ALPS controller nor to the representation descriptor.
2015-04-13 13:30:33 +02:00
Oliver Gierke
d70851cda8 DATAREST-511 - Support for executing repository methods returning Optionals.
Added an UnwrappingRepositoryInvokerFactory that transparently unwraps JDK 8 and Guava Optionals to make sure the consuming code works with values or plain nulls correctly.
2015-04-13 09:29:33 +02:00
Oliver Gierke
49bad45b5f DATAREST-506 - NotModified responses now return headers, too.
Responses for item resources that result in 304 Not Modifier now also return the headers they'd return if a 200 Ok would've been returned.
2015-04-12 18:44:26 +02:00
Oliver Gierke
ba9f1b36ab DATAREST-515 - RepositorySearchesResource now exposes domain type.
RepositorySearchesResource now exposes the domain type for whom the searches are listed to allow implementations of ResourceProcessor add links by type more easily.
2015-04-11 16:48:42 +02:00
Oliver Gierke
4bb7612094 DATAREST-509 - Fixed typo in reference docs section on projections. 2015-04-08 18:27:23 +02:00
Oliver Gierke
3831479aca DATAREST-507 - Fixed IllegalArgumentException in RepositoryRestExceptionHandler.
A lot of cleanups in RepositoryRestExceptionHandler: prefer static methods where possible. Removed delegates where only one client was calling the method. Consistent argument ordering with optional (nullable) parameters last.

Silenced logging in unit tests for RepositoryRestExceptionHandler.
2015-04-08 17:39:48 +02:00
Oliver Gierke
3d1ac0c461 DATAREST-506 - Support for conditional GETs on item resources.
We now inspect If-None-Match and If-Modified-Since headers on GET requests to item resources and return 304 Not Modified if appropriate.

Disable rendering of version property in Jackson serializer as it's reflected in the ETag.

Related tickets: DATAREST-160, DATAREST-471.
2015-04-08 15:11:13 +02:00
Oliver Gierke
5895b5e692 DATAREST-302 - Rendering projections includes/keeps links.
We now treat embedded projections as Resource instances and equip them with a self link. This should also allow to register ResourceProcessor instances for projection types to even add projection specific links if necessary.

Also removed the explicit removal of the association link in case a projection is rendered for an association.
2015-04-02 17:03:11 +02:00
Oliver Gierke
1da9808edb DATAREST-500 - Enable lazy-loading proxy resolution on Hibernate 4 module.
We now explicitly activate the resolution of lazy-loading proxies on Hibernate 4 to make sure not already populated lazy-loading proxies are actively resolved.
2015-03-30 21:31:16 +02:00
Oliver Gierke
977ccb1a36 DATAREST-498 - IncomingRequest now correctly evaluates parameterized media types.
IncomingRequest.isJsonPatchRequest()/….isJsonMergePatchRequest() previously did a hard equals comparison to the media type discovered in the request. This fails if the request's media type contains parameters (e.g. the charset).

We now rather use MediaType.isCompatibleWith(…) to compare the media types more leniently.

Renamed test case to match conventions so that the Maven build actually executes them.
2015-03-30 10:50:46 +02:00
Oliver Gierke
a20de13238 DATAREST-493 - After release cleanups. 2015-03-30 10:50:40 +02:00
Spring Buildmaster
b65c4de7af DATAREST-493 - Prepare next development iteration. 2015-03-30 10:49:31 +02:00
Spring Buildmaster
338047fd62 DATAREST-493 - Release version 2.3.0.RELEASE (Fowler GA). 2015-03-23 05:36:57 -07:00
Oliver Gierke
830ed24299 DATAREST-493 - Prepare 2.3.0.RELEASE (Fowler GA). 2015-03-23 12:37:23 +01:00
Oliver Gierke
243ba4c1d4 DATAREST-493 - Updated changelog. 2015-03-23 12:04:14 +01:00
Oliver Gierke
c12009337b DATAREST-494 - ALPS metadata now links to JSON Schema.
The ALPS document rendered now links to the JSON Schema document from within the core representation descriptor to allow clients to obtain more detailed information about the payloads to send and receive.
2015-03-23 08:49:48 +01:00
Oliver Gierke
e5ce6156f9 DATAREST-492 - Fixed JSON Schema type detection for primitive numbers.
We now correctly detect primitive numbers in domain objects so that the JSON Schema type of the property is number as expected.
2015-03-22 20:06:43 +01:00
Greg Turnquist
462570fc24 DATAREST-449 - Polished up reference docs.
Original pull request: #170.
2015-03-22 18:11:11 +01:00
Greg Turnquist
707bac94c2 DATAREST-478 - Polished up bits of documentation.
Original pull request: #169.
2015-03-22 18:06:59 +01:00
Greg Turnquist
583284a9f0 DATAREST-453 - Added appendix linking to Spring Data examples.
Added a new section that lists Spring Data REST specific example projects.

Original pull request: #168.
2015-03-22 18:06:25 +01:00
Oliver Gierke
f80bebf04b DATAREST-491 - Fixed handling of non-entity maps in JSON processing.
During our custom JSON handling on PUT requests, we previously piped all JSON objects through code that expected that one to be mapped to a PersistentEntity. This fails for JSON objects that basically represent maps.

We now skip that code paths for non-entity properties.
2015-03-20 09:42:36 +01:00
Oliver Gierke
5486712b1b DATAREST-34 - Polishing.
Moved decision logic on whether to return response bodies int RepositoryRestConfig to ease testability of the controller. Added more unit tests and simplified the controller integration tests accordingly. Had to deactivate some Cassandra related tests as they don't seem to handle nulling of properties correctly.

Changed configuration to rely on the presence of the Accept header by default. Deprecated parameterless isReturnBodyFor…(…) methods in favor of the ones taking the Accept header to avoid the null checks on the calling side.

Polished JavaDoc for the isReturnBodyOn(Create|Update) methods. Polished formatting in RepositoryEntityController.

Original pull request: #167.
2015-03-20 08:50:47 +01:00
Jeremy Rickard
f3c74ac9db DATAREST-34 - PUT and POST request now consider Accept header by default.
By default, whether to return response bodies for PUT and POST is determined by the presence of an Accept header, unless explicitly activated or deactivated in RepositoryRestConfiguration.

Original pull request: #167.
2015-03-20 08:50:30 +01:00
Oliver Gierke
4f8298c711 DATAREST-490 - Makes sure content negotiation works for manual resource overrides with dedicated media type.
In case a manually implemented controller is registered to add a dedicated media type for a Spring Data REST resource (e.g. an HTML representation for item resources) we now continue to serve JSON in case the request indicates it wants to see it.

Previously this didn't work as the manually implemented controller method was detected to partially match (only the produces-clause not matching) and thus an exception being thrown from the HandlerMapping lookup. This caused the HandlerMapping registered for repositories not being considered at all.

This is now fixed by hiding the HandlerMapping instances we register behind a DelegatingHandlerMapping that continues to try delegates even in a case of an exception being caused in a particular resolution attempt. Should all resolution attempts fail, we then throw the original exception if one occurred in the first place.
2015-03-11 15:14:00 +01:00
Oliver Gierke
83e1ca0072 DATAREST-487 - After release cleanups. 2015-03-11 15:13:56 +01:00
Spring Buildmaster
7b53546236 DATAREST-487 - Prepare next development iteration. 2015-03-05 10:28:08 -08:00
Spring Buildmaster
c52b72047f DATAREST-487 - Release version 2.3.0.RC1. 2015-03-05 10:28:07 -08:00
Oliver Gierke
8f988036e2 DATAREST-487 - Prepare 2.3.0.RC1 (Fowler RC1). 2015-03-05 19:18:07 +01:00
Oliver Gierke
791f6d057c DATAREST-487 - Updated changelog. 2015-03-05 15:54:43 +01:00
Oliver Gierke
b1ef67211f DATAREST-487 - Dependency upgrades in preparation of the release.
Upgraded to Spring HATEOAS 0.17.0.RELEASE, Spring Plugin 1.2.0.RELEASE as well as Evo Inflector 1.2.1.
2015-03-05 11:22:29 +01:00
Oliver Gierke
def74e6618 DATAREST-354 - General rewrite of the JSONSchema support.
Significant overhaul of the JSONSchema support. This currently adds the following features:

- Complex nested types are exposed as descriptors with the properties pointing to them whenever necessary.
- Sets are treated as unique collections.
- Enums are handled as expected (enum values are listed).
- Renamings via @JsonProperty are considered.
- @JsonProperty(required = true) is considered and added to required properties.
- Date/time types (legacy Date, JSR-310, ThreeTenBP and Joda Time) are exposed with format "date-time".
- Objects with @JsonValue methods are considered to be rendered as String value.
- Formats and patterns can be manually configured on MetadataConfiguration.

TODOs:

- Implementation polish, JavaDoc
- Automatically inspect ObjectMapper to detect customizations made through Mixins and custom Serializers.
2015-03-05 10:13:47 +01:00
Tom Crossland
ed5bde10e7 DATAREST-484 - Corrected a tiny spelling mistake in projections-excerpts.adoc.
Original pull request: #166.
2015-03-04 11:53:45 +01:00
Oliver Gierke
c532bb0d51 DATAREST-485 - Fixed handling of empty requests for RepositoryPropertyReferenceController.createPropertyReference(…).
The test case introduced for DATAREST-482 failed when running against Spring 4.1 generation as the handling of empty request payload changed slightly in 4.1. We now explicitly use required = false to get null handed into the controller and manually default the Resources<Object> in it.

Related tickets: DATAREST-482, SPR-12778.
2015-03-03 09:49:38 +01:00
Oliver Gierke
8cbd952d88 DATAREST-483 - Upgrade to JSONPath 0.9.1 and Spring HATEOAS 0.17.0 snapshots. 2015-03-02 17:41:02 +01:00
Greg Turnquist
ebbe77da5b DATAREST-450 - Migrate wiki content to reference docs.
Scrubbed old format. Lightened up paging section and focus more on "next"/"prev" hypermedia controls and their benefit. Moved several sections under one top level section called "Customizing Spring Data REST". Cleaned up index.adoc to match the style of Spring Data JPA. Removed JSONP section.
Remove embedded entity operations, based on old spring-data-rest-compact media type. Utilized relative leveloffset for each include. Corrected some ALPS mistakes.

Original pull request: #162.
2015-02-27 10:13:26 +01:00
Oliver Gierke
8b3b7bac98 DATAREST-482 - Added test cases for MongoDB association handling on PUTs.
Added a test case that verifies associations to stay intact if someone updates the item resource using a PUT. Added a second test case that shows PUTting an empty String with media type text/uri-list results in the associations wiped.
2015-02-26 11:48:08 +01:00
Greg Turnquist
7d13c447fe DATAREST-451 - Add projection and excerpt to reference documentation.
Original pull request: #163.
2015-02-25 17:19:01 +01:00
Greg Turnquist
d6595970e3 DATAREST-452 - Add ALPS metadata to reference documentation.
Original pull request: #164.
2015-02-25 15:45:34 +01:00
Oliver Gierke
0a542564bc DATAREST-463 - Polishing.
Collapsed if clauses leading to the very same return in RootResourceinformationToAlpsDescriptorConverter. Renamed isExportableProperty(…) to isExportable(…) in JacksonMetadata. Removed commented out code in AssociationLinks. Cleanups in test code.

Original pull request: #160.
2015-02-22 15:23:46 +01:00
Greg Turnquist
8d47fab92c DATAREST-463 - Hide ignored attributes from ALPS metadata.
If @JsonIgnore is applied to either a field or a getter method for an association, then do not expose that property's metadata down from ALPS.

Original pull request: #160.
2015-02-22 15:21:24 +01:00
Oliver Gierke
98fd079b21 DATAREST-469 - Added dedicated resource type for search links.
RepositorySearchController now returns a RepositorySearchesResources so that users can implement a custom ResourceProcessor to augment the list of links exposed for Spring Data repository query methods.
2015-02-09 10:52:37 +01:00
Oliver Gierke
ec2bd0145d DATAREST-471 - Populate Last-Modified headers from auditing information.
We now populate the Last-Modified header for requests to the item resource and search resource invocations that return a single item.
2015-02-04 21:03:57 +01:00
Oliver Gierke
14cee9c94f DATAREST-467 - RepositoryEntityLinks now exposes methods to create links to search resources.
RepositoryEntityLinks now exposes methods to obtain links to all search resources and individual ones, including overloads to pre-expand Pageable and Sort parameters potentially contained in the method signature.

Search links now also contain a projection template variable if the type returned by the query method backing the search resource has projections registered.
2015-01-30 20:46:03 +01:00