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.
RepositorySearchController now takes all request parameters as MultiValueMap to execute query methods. For parameters mapping to a managed resource we try to interpret the given parameter value as URI to actually trigger the URI-to-entity resolution through the newly registered UriToEntityConverter.
The latter is now registered with the default ConversionService registered so that it's
A lot of cleanups in RepositorySearchController. Removed some obsolete prints to the console to reduce log output during test execution.
Related ticket: DATACMNS-678.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
The Cassandra tests sometimes cannot to the embedded instance on the CI server. Added a triple retry with a delay of 200ms to work around a potentially slow Cassandra bootstrap.
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.
Extracted groups of dependencies into auto-activated profiles to make more visible which dependencies belong to which store. Simplified dependency setup where possible.
General polishing in the test cases added.
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.
Dropped our Converter implementations for Point and Distance and rather use the ones provided through Spring Data Commons, the addFormatters(…) method of SpringDataWebConfiguration in particular.
Related ticket: DATACMNS-626.
Handling HttpMessageNotReadableException in RepositoryRestExceptionHandler previously handed null to the badRequest(…) method resulting in an assertion failure in response(…) eventually. This is now fixed by handing in an HttpHeaders instance.
Introduced a new property basePath on RepositoryRestConfiguration to allow a smooth migration to a new non-absolute base path configuration model to customize the URIs under which repository resources are exposed.
We're deprecating the current baseUri property as it previously supported absolute URIs. These are still supported but a warning is logged to ping users to move to the new base path based configuration.
We now use the base path to dynamically augment the mappings detected on our controllers with the path configured.
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.
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.
Added configuration for setting up an EmbeddedSolrServer instance within a temporary directory. We use a temporary test folder created by JUnit where we copy the required configuration to. The directory will also hold all index data and will be deleted afterwards.
Original pull request: #156.
Removed leftovers from AbstractRepositoryRestController. Renamed GlobalExceptionHandler to RepositoryRestExceptionHandler and minimized visibility of exception handler methods. Restricted application of the exception handler to controllers in the Spring Data REST base package.
Relatted pull request: #155.
The annotation based event handling now relies on the type of the first method argument to determine the domain type the handler is interested in. Improved method invocation to not unnecessarily wrap exceptions thrown from them. Changed the test cases to throw a dedicated runtime exception to implicitly test that the
Renamed LinkSaveEvent to LinkedEntityEvent as it's not only used for save-events for entities. Make use of Methods' USER_METHOD filter. Moved the class into the util package. Removed the UUID converter as Spring's DefaultFormattingConversionService provides it out of the box.
Added missing license headers and JavaDoc. Deprecated Class<?> attributes on handling annotations.
Related pull request: #151.
Introduced a dedicated value object for ETags and moved the logic of ETagValidator into it. Switched from an annotation based injection model to a type based one.
The HTTP status code for a non-matching ETag is now 412 Precondition failed as the HTTP specification suggests.
Original pull request: #148.