313 Commits

Author SHA1 Message Date
Spring Buildmaster
e78c0a56af DATAREST-693 - Prepare next development iteration. 2015-10-14 04:15:56 -07:00
Spring Buildmaster
39fee70e13 DATAREST-693 - Release version 2.2.4.RELEASE (Evans SR4). 2015-10-14 04:15:54 -07:00
Spring Buildmaster
061c56ae29 DATAREST-602 - Prepare next development iteration. 2015-06-30 16:30:52 -07:00
Spring Buildmaster
65ba37f266 DATAREST-602 - Release version 2.2.3.RELEASE (Evans SR3). 2015-06-30 16:30:50 -07:00
Oliver Gierke
b50efd3f38 DATAREST-588 - Tweak ResourceSupportHttpMessageConverter to really reject all non-configured types.
We now override canRead(Type, Class<?>, MediaType) and tweak some of the delegate to reflect the patch in Spring HATEOAS spring-hateoas/#360 but without having to upgrade to the new version.
2015-06-24 17:29:11 +02:00
Oliver Gierke
1e223bd762 DATAREST-556 - Fixed JsonNode handling for PUT/PATCH with a custom field naming strategy.
The preparation of the JsonNode that we map onto the domain object now correctly looks up fields by their mapped names. Previously we accidentally checked the incoming JSON for fields with raw unmapped property names with caused fields invalid detected or not detected if a custom Jackson naming strategy was in place.
2015-05-26 18:03:16 +02:00
Andy Wilkinson
f335d30f11 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:21 +02:00
Oliver Gierke
46e16cde90 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:56:29 +02:00
Oliver Gierke
b4bfee3bc5 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:16 +02:00
Oliver Gierke
e32589e403 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:55:56 +02:00
Oliver Gierke
2de98cbfd6 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 21:53:28 +02:00
Oliver Gierke
8414b290b9 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:41:52 +01:00
Oliver Gierke
91dacf9484 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:51:47 +01:00
Oliver Gierke
8fba7dc6db 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:30:02 +01:00
Greg Turnquist
180d0ce3f4 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:28:35 +01:00
Spring Buildmaster
2b6f96d149 DATAREST-459 - Prepare next development iteration. 2015-01-28 07:31:27 -08:00
Spring Buildmaster
fd7d3cf7d9 DATAREST-459 - Release version 2.2.2.RELEASE (Evans SR2). 2015-01-28 07:31:18 -08:00
Oliver Gierke
2376f14b72 DATAREST-470 - Moved to EclipseLink JPA API JAR instead of Hibernate. 2015-01-27 22:22:29 +01:00
Oliver Gierke
cecdde96ca DATAREST-461 - Ignore unmapped properties when applying PUT requests.
We now make sure that unmapped properties (e.g. by using @JsonIgnore) are ignored when applying PUT request payloads. To do so we now basically use the merging algorithm used for PATCH requests but make sure we fill up the request payload with explicit null values for all mapped but not contained properties.
2015-01-21 14:51:16 +01:00
Oliver Gierke
93202f3696 DATAREST-460 - Polished RepositoryRestMvcConfiguration to fix CGLib proxying.
Made private methods that call @Bean methods protected so that they can become subject to CGLib proxying. Inlined getDefaultedRelProvider().
2015-01-20 10:39:41 +01:00
Neeme Praks
72f50e9f79 DATAREST-457 - Fixed typo in JavaDoc of BaseUri.
Original pull request: #159.
2015-01-20 08:00:37 +01:00
Oliver Gierke
d248f60701 DATAREST-434 - Forward root exception in PersistentEntityResourceHandlerMethodArgumentResolver. 2015-01-08 10:54:54 +01:00
Oliver Gierke
a9199da896 DATAREST-427 - Refactorings in UriToEntityConverter.
Instead of using a DomainClassConverter directly we now use a raw ConversionService in UriToEntityConverter. This allos us to get rid off the bean definitions for UriToEntityConverter and DomainClassConverter. The population of the ConversionService is now taken care of by calling SpringDataWebConfiguration's addFormatter(…) in defaultConversionService().

Added unit tests for UriToEntityConverter.
2015-01-05 15:48:10 +01:00
Oliver Gierke
4ba65a52a3 DATAREST-424 - Registered HttpMessageConverters now implement Ordered.
To be able to control the order of the HttpMessageConverter beans registered by RepositoryRestMvcConfiguration we now use a dedicated subtype of TypeConstrainedMappingJackson2HttpMessageConverter which additionally implements Ordered.
2014-12-10 19:47:02 +01:00
Oliver Gierke
11668b3439 DATAREST-423 - Fixed HandlerAdapterSetup to consider ConversionService.
The special RepositoryRestHandlerAdapter we set up for repository invocations didn't consider the ConversionService Spring Data REST sets up. This causes binding issues in case someone wants to override resource handling by declaring an @RepositoryRestController and using a domain type as handler method argument.

We now explicitly configure the RepositoryRestHandlerAdapter to use the ConversionService we set up and equip with Spring Data Commons' DomainClassConverter.
2014-12-09 13:15:21 +01:00
Oliver Gierke
47622630a3 DATAREST-227 - Renamed WebTestUtils to TestMvcClient.
Renmaed WebTestUtils to TestMvcClient, added assertions to constructor and fixed formatting of JavaDoc.

Original pull request: #149.
2014-11-10 16:56:48 +01:00
Greg Turnquist
3cba04d9b0 DATAREST-227 - Broke up AbstractWebIntegrationTest and its subclasses.
Decouple the test machinery of this class from the barrage of common test cases used against the various data stores. This way, other test suites that use the same integration approach don't have to be a part of this class hierarchy. Also move utilities and assertion methods into separate utility classes to slim down the class hierarchy.

Original pull request: #149.
2014-11-10 16:56:41 +01:00
Spring Buildmaster
942bb63c19 DATAREST-401 - Prepare next development iteration. 2014-10-31 13:27:03 -07:00
Spring Buildmaster
050b3140ba DATAREST-401 - Release version 2.2.1.RELEASE. 2014-10-31 13:26:59 -07:00
Oliver Gierke
f51c0154ee DATAREST-381 - Improved HandlerMapping infrastructure to make sure controllers consider base URI.
Removed class-level @RequestMapping annotations as the controllers get picked up by standard Spring MVC and are exposed via the root even if a base URI is configured. Created custom @BaseUriAwareController and use that in AlpsController to make sure it doesn't get picked up by Spring MVC.
2014-10-21 22:12:09 +02:00
Oliver Gierke
7812587931 DATAREST-384 - Fixed affordances and execution of sortable search resources.
Search resources are now considered sortable if they contain a Sort parameter. This is now reflected in MethodResourceMapping.isSortableResource().

Building on top of that, the RepositorySearchController now appends the sort template variable to links generated when listing search resources. It also now accepts resolved Sort instances to forward them to the query method execution. The controller now also uses DefaultedPageable so that request missing pagination information use the defaults configured for the PageableHandlerMethodArgumentResolver.
2014-10-15 13:32:32 +02:00
Spring Buildmaster
0190789486 DATAREST-380 - Prepare next development iteration. 2014-09-05 14:22:10 +02:00
Spring Buildmaster
31b689a566 DATAREST-380 - Release version 2.2.0.RELEASE (Evans GA). 2014-09-05 03:56:15 -07:00
Spring Buildmaster
78ec4a8771 DATAREST-374 - Prepare next development iteration. 2014-08-13 07:27:55 -07:00
Spring Buildmaster
37a5300e87 DATAREST-374 - Release version 2.2.0.RC1 (Evans RC1). 2014-08-13 07:27:52 -07:00
Oliver Gierke
2d64fb4d84 DATAREST-326 - Improved configuration setup for better Boot compatibility.
We now don't expose the PersistentEntityJackson2Module as bean anymore to prevent global registration in case of a Boot setup. The HttpMessageConverters registered are now TypeConstrainedMappingJackson2HttpMessageConverters so that they only get used of the object to marshal is of type ResourceSupport.
2014-07-25 16:33:07 +02:00
Oliver Gierke
aa28aebca5 DATAREST-353 - Fixed potential NullPointerException when trying to delete a non-existing resource.
We now correctly return a 404 Not Found in case we receive a DELETE request for a resource not existing.
2014-07-16 17:44:02 +02:00
Spring Buildmaster
9e1c607abb DATAREST-350 - Prepare next development iteration. 2014-07-10 20:35:04 +02:00
Spring Buildmaster
527d2391ce DATAREST-350 - Release version 2.2.0.M1. 2014-07-10 20:35:04 +02:00
Oliver Gierke
b29fea84e9 DATAREST-333, DATAREST-348 - OPTIONS requests now expose Accept-Patch header.
As recommended in RFC 5789, the support for PATCH request should be advertised in OPTIONS requests (already in place) and include an Accept-Patch header listing the patch media types supported. We now include the media types for JSON Patch, JSON Merge Patch and plain JSON in that header.

[0] http://tools.ietf.org/html/rfc5789#section-3
2014-07-10 17:07:55 +02:00
Oliver Gierke
020de45c1b DATAREST-230 - Support for serving Alps documents.
This commit adds the support to expose additional resources that serve ALPS [0] resources to document the available state transitions and representations. The exposure is enabled by default and can be customized using the RepositoryRestConfiguration.metadataConfiguration() object.

Currently the set of descriptors exposed includes:

- A descriptor for the representation of the domain type. Linkable associations are represented as safe descriptors, ones that are not linked are semantic descriptors.
- Descriptors for each supported HTTP method for both the collection and item resources to indicate the ability to update, create, delete etc.
- Safe descriptors (e.g. to access the collection or item resource) get potentially available customizations (pagination, projections) attached through nested descriptors.

Documentation

An ALPS descriptor contains a doc attribute to carry semantic information for the end user or a potential client to display. The information can be described in two ways: the first one is the @Description annotation that captures the plain text information one wants to get listed. It is supported in @RepositoryRestResource, on query methods, projection interfaces and accessors etc.

The preferred approach however is to use a resource bundle rest-messages.properties. For each descriptor we will resolve a key starting with rest.description followed by a dot path into the resource. By default, doc attributes are only rendered if the resource bundle contains an entry for the relevant key. You can enforce displaying unresolved keys by configuring MetadataConfiguration.omitUnresolvableDescriptionKeys(…).

For representation descriptors and and the parameter list of query method descriptors we will display enum values by default as comma-separated list. The list is also available as message resolution argument, so that you can refer to the list in your description message via the {0} placeholder.

TODOs:

- Improve descriptors for associations (indicate ability to update etc.)

[0] ALPS - http://alps.io
2014-07-10 17:07:55 +02:00
Oliver Gierke
b9aef87e05 DATAREST-337 - Fix trailing whitespace in poms. 2014-07-08 14:05:24 +02:00
Oliver Gierke
ef3720be11 DATAREST-348 - Support for json-patch+json and merge-patch+json media types.
We now support PATCH request with application/json-patch+json [0] and application/merge-patch+json media types. The support is based on some customized usage of the FGE JSON Patch library [2]. 

As we need to apply the patch to an existing object, we need translate the JSON Patch remove operation into a replace operation setting the value to null so that out entity processing component registers the request for removal. Same applies to requests for merge-patch+json.

From an implementation point of view the handling of the media type has moved from the controller into PersistentEntityResourceHandlerMethodArgumentResolver and its delegates, n particular JsonPatchHandler. The application of the changes to the existing domain object is handled in the newly introduced DomainObjectReader.

Related ticket: DATAREST-345.

[0] http://tools.ietf.org/html/rfc6902
[1] http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch
[2] https://github.com/fge/json-patch
2014-07-08 14:04:47 +02:00
Oliver Gierke
59b15933ae DATAREST-343 - Added jackson-annotation as explicit dependency.
Added explicit dependency to jackson-annotations as a library previously declared might pull in that one in a different version which might cause conflicts.
2014-07-01 10:59:02 +02:00
Oliver Gierke
e6949f8a46 DATAREST-340 - AssociationOmittingSerializerModifier now keeps non-persistent property writers.
AssociationOmittingSerializerModifier previously dropped the writer fro a particular property if it couldn't find a PersistentProperty for the bean property. We now keep those writers to make sure that non-persistent, additional fields are written as well.

Related issues: https://github.com/spring-projects/spring-boot/issues/1190
2014-06-30 13:31:16 +02:00
Oliver Gierke
2bfa422ee7 DATAREST-328, DATAREST-320 - AssociationOmittingSerializerModifier now correctly considers renamed properties.
Previously, if a persistent property was renamed using e.g. @JsonProperty, the lookup of the PersistentProperty failed as BeanPropertyWriter exposes the final (renamed) property name, not the internal one. We now defensively lookup the correct BeanPropertyDescriptor using the external name and use the corresponding internal one for the PersistentProperty lookup.
2014-06-27 18:43:02 +02:00
Oliver Gierke
2f1e9824cd DATAREST-336 - Default to ISO8601 date rendering. 2014-06-26 12:13:38 +02:00
Oliver Gierke
0f5d790dbd DATAREST-331 - Fixed NullPointerException in ResourcesProcessorWrapper.
During type matching in ResourcesProcessorWrapper we now accomodate the scenario that a Resources type is completely different than the Resources type to look for. This resulted in null being returned for the supertype generics lookup and this failed as the corresponding guard was missing.
2014-06-26 11:24:55 +02:00
Oliver Gierke
e70285331c DATAREST-333 - Added controller mappings for OPTIONS requests.
The root resource, collection and item resources as well as the search and query method resources now expose a handler method to handle OPTIONS requests and return a response with the Allow header set to the HTTP methods appropriate to the resource requested.

Added some additional methods for HEAD requests and a few integration tests for functionality that previously existed.

Related ticket: DATAREST-330.
2014-06-26 09:43:37 +02:00
Oliver Gierke
8618b7df8e DATAREST-182 - Removed obsolete wirings from AbstractRepositoryRestController.
Removed the wirings for PlatformTransactionManager and ValidationExceptionHandler from AbstractRepositoryRestController. Removed the latter entirely as it doesn't seem to be used anywhere anyway.
2014-06-24 23:38:16 +02:00