Cleanups in Affordance API and implementations of hypermedia type (de)serializers. Added a lot more domain methods and types to Link, ResourceSupport etc. to be able to move a lot of representation building logic into those.
AffordanceModelFactory is not a Spring Plugin anymore as that functionality is not needed currently as we statically look up all factories via the SpringFactoriesLoader mechanism.
Redesigned LinkRelation to become a first class abstraction in the codebase. IanaLinkRelations is now a collection of constants. Link now keeps a LinkRelation instance around instead of a plain String.
Tweaked LinkDiscoverer API to return Optional and Links instead of nullable Link and List<Link>.
Tweaked API of CurieProvider to make use of the newly introduced HalLinkRelation based on the general LinkRelation.
Additional fixes for the Kotlin extension functions. Make Kotlin build setup compile with JDK 8. Removed Objects helper class in favor of Spring's already existing Assert and it's usage in ResourceAssemblerSupport.
Moved AffordanceModelFactory to the library's root package. Moved Kotlin extensions to hateoas.mvc package.
Added an ArchUnit based test for package cycles.
* Move Spring MVC method scanning out of the core Affordances API and into SpringMvcAffordanceBuilder to make it easy to use in Spring Data REST (where method scanning isn't needed).
* Also push attributes from Affordance into AffordanceModel to centralize the details.
* Certain serializers must be registered differently due to Jackson's rules of precedence given Spring Data REST needs to override them.
* Added Tests to demonstrate required functionality.
* Expanding variables correctly to meet RFC spec. Composite values can be expanded either as a list or as an associative array
Also see https://tools.ietf.org/html/rfc6570#section-2.4.2
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.
To support people that have already built apps on top of Lists, include a `toList<D>` method that honors the old contract.
Related issues: #493
Related pull requests: #572
In HAL-based documents (HAL and HAL-FORMS), the "templated" property must be ignored in LinkMixin, because that's where it is applied. Removes the need for a no-op `setTemplated` method in Link.
* Test cases drafted for both HAL an HAL-FORMS to verify proper behavior.
* Jackson2HalFormsIntegrationTest migrated from Hamcrest to AssertJ assertions.
Related pull requests: #668
* Moved compilation of Regexp patterns out of methods in order to not repeat it over and over again.
* Applied soft assertions where multiple assertions where used where one failure didn't guarantee the failure of all other assertions.
* Minor formatting.
Deserializing a Link with a templated URI will cause Jackson to break due to there being no "templated" property. This adds a private, no-op `setTemplated` method to allow deserialization to occur yet not alter the Link..
By removing all Jaxb annotations, requesting data from a hypermedia-enabled endpoint inside a browser (which defaults to accept:application/xhtml+xml,*/*), Spring HATEOAS will yield HAL.
Spring 5.1 is centralizing all Forward header handling. This moves critical bits into one location, making it easy to completely remove once we rebaseline against this version.
Also adds a test profile to ensure Spring 5.1 doesn't break anything.
Original pull request: #717.
We now avoid to register ObjectMapper instances as Spring beans and rather use one already existing in the ApplicationContext and copying the setup before registering the individual HttpMessageConverters for the individual media types.
Replaced a lot of the programmatic component setup via BeanDefinitions with their corresponding JavaConfig alternatives.
Removed obsolete media type specific HttpMessageConverters and configuration classes registering them.
Introduce support for media type application/vnd.collection+json. Collection+JSON doesn't allow metadata at the top, so paging data can't be covered, however, everything else fits.
Also moved a little bit more into Affordance and SpringMvcAffordance to avoid using Spring MVC annotations directly in a given mediatype's AffordanceModel.
Refactored bits of HAL-FORMS to reuse the new PropertyUtils, ensuring Jackson ignore annotations are taken into consideration. Also added MockMVC tests to show HAL-FORMS and Collection+JSON working together, against the same controller.
According to the ALPS spec, it's "descriptor" not "descriptors", despite it depicting an array of potentially multiple values. Also fixed the ordering to match as closely as possible all the samples shown in the spec.
Original pull request: #666.