Commit Graph

490 Commits

Author SHA1 Message Date
Oliver Drotbohm
5f772e30c5 #845 - Polished Link, UriTemplate, TemplateVariables and IanaLinkRelations.
Added Link.toURI() to conveniently create URIs from Link instances.
2019-03-01 15:53:45 +01:00
Oliver Drotbohm
23c0a34c66 #842 - Remove Identifiable. 2019-02-28 23:58:42 +01:00
Oliver Drotbohm
3077211db2 #844 - Moved TypeReferences to server.core package. 2019-02-28 20:29:55 +01:00
Oliver Drotbohm
ff8bc33daf #843 - Introduced EntityLinks.link(To|For)ItemResource(Object, Function).
The introduced methods allow clients to pass an identifier extractor function. Also introduced a new (Extended)TypedEntityLinks that exposes the same functionality as EntityLinks but with a shared identifier extractor function so that clients don't have to provide it for each method invocation.

Prepares the fix for #842.
2019-02-28 20:29:06 +01:00
Oliver Drotbohm
33f22e8bc9 #841 - Added builder API to HalLinkRelation.
This allows more convenient setup of multiple HalLinkRelation instances for the same curie.

Additional unit tests.
2019-02-28 17:23:59 +01:00
Oliver Drotbohm
81af032810 #840 - LinkDiscoverer now exposes methods to lookup required links.
Introduced findRequiredLinkWithRel(…) methods on LinkDiscoverer to delegate to existing lookups but resolving the Optional into an IllegalArgumentException.

Fixed JsonPathLinkDiscoverer to return no links at all if a required path segment in the payload cannot be found which would have triggered a PathNotFoundException before.

Polished parameter names and JavaDoc. Moved base test cases into the right packages.
2019-02-28 17:00:35 +01:00
Oliver Drotbohm
df4e099458 #838 - Improved registration of BeanPostProcessor implementations.
The BeanPostProcessor implementations in (WebMVC|WebFlux)HateoasConfiguration are now declared as static methods and their dependencies use ObjectProvider wrapper types to prevent the need to prematurely initialize the entire configuration class which triggered the creation of a lot of downstream dependencies which were then reported as ineligible for post processing themselves.
2019-02-28 15:56:08 +01:00
Oliver Drotbohm
a89e57eed7 #833 - Changed ResourceSupport class name hierarchy. 2019-02-27 20:04:15 +01:00
Oliver Drotbohm
57f36a58db #833 - Migrate packages.
Changed the package structure to better reflect the different modules of the library. All client related code now lives in the client package, server related APIs in server with their respective WebMVC and WebFlux implementations in sub-packages.

Added migration script to allow users to easily migrate to the new structure and added reference documentation section on the migration.

Traversons built in defaulting to HAL HttpMessageConverters and LinkDiscoverer implementation now caused a cyclic relationship between the client and mediatype.hal packages. This has be fixed by looking up the defaults via a SpringFactories interface.
2019-02-27 12:59:58 +01:00
Greg Turnquist
cc57e2eb44 #833 - Fix each media type with a unique LinkDiscoverer bean name. 2019-02-27 12:16:55 +01:00
Oliver Drotbohm
7733f39796 #833 - Introduce SpringFactories-based SPI for custom media types.
We now expose a MediaTypeConfigurationProvider SPI interface that media type implementations can register an implementation class for in META-INF/spring.factories. The implementation class then has to provide a root Spring configuration class to be included into the bootstrap and expose whether it's supposed to be included for a given set of media types.

Configuration classes are supposed to implement HypermediaMappingInformation to expose either a Jackson module or code to configure the Jackson ObjectMapper to be used in the mapping infrastructure of the supported web stacks (WebMVC and WebFlux).
2019-02-27 12:16:47 +01:00
Greg Turnquist
8c366e1687 #833 - Add API to register custom media types. 2019-02-27 12:16:08 +01:00
Greg Turnquist
8af414d3cf #815 - Polishing. 2019-02-22 22:55:59 -06:00
Greg Turnquist
9c684c0060 #815 - Test against Spring Framework 5.1/5.2 snapshots. 2019-02-21 11:24:02 -06:00
Greg Turnquist
daf94ed7b9 #815 - Make releases from Concourse.
Related to #814.
2019-02-21 11:24:02 -06:00
Oliver Drotbohm
82efbfb6aa #798 - Polishing.
Removed inclusion of broken stylesheet CSS.
2019-02-21 16:52:47 +01:00
Oliver Drotbohm
1de60802e9 #811 - Polishing. 2019-02-21 16:46:57 +01:00
Oliver Drotbohm
aea4c4c91f #811 - Added ability to override single link render mode per link relation.
HalConfiguration now exposes a withSingleLinkRenderModeFor(…) taking a path pattern to be rendered in the also given RenderSingleLinks mode. It takes patterns as link relations are either plain strings or valid URIs.

Simplified HAL link list rendering in Jackson2HalModule avoiding double nesting of collections before rendering.
2019-02-21 16:46:53 +01:00
Greg Turnquist
943e9afc08 #728 - Update Kotlin DSLs to use WebMvcLinkBuilder. 2019-02-21 12:27:51 +01:00
Oliver Drotbohm
e82d42f45a #728 - Polishing. 2019-02-21 12:27:51 +01:00
Oliver Drotbohm
1d9703abbe #728 - API polishing.
Renamed LinkBuilder implementations for the different web stacks Web(MVC|Flux)LinkBuilder for symmetry. Introduced dedicated builder types to be used from WebFluxLinkBuilder to more conveniently integrate with reactive flows (see the changes in WebFluxEmployeeController).

Deprecated ControllerLinkBuilder(Factory) in favor of WebMvcLinkBuilder(Factory).

Generally untangled the use of WebMvcLinkBuilder from the reactive examples.
2019-02-21 12:27:51 +01:00
Oliver Drotbohm
576274c1b2 #728 - Fix dependency cycles in WebFlux / WebMVC code
WebHandler is now independent of a particular web stack as the final LinkBuilder creation is externalized through a SAM type that client code now uses to pass a constructor. Refactored the ReactiveLinkBuilder to avoid a dependency on ControllerLinkBuilder (read: the WebMVC stack). With that change, WebHandler is now moved back to the core package.

Refactored LinkBuilderSupport to keep a UriComponentsBuilder instance around instead of UriComponents. It creates a defensive copy of the builder instance on state modifying invocations and returns a new LinkBuilderSupport instance.

Moved SpringMvcAffordanceBuilder to the core package and removed Mvc segment from its name to make obvious it's not tied to SpringMVC. Introduced TemplateVariableAwareLinkBuilderSupport as common base class between ControllerLinkBuilder and ReactiveLinkBuilder. It extracts the TemplateVariable behavior from ControllerLinkBuilder.

Extracted import of web stack specific configuration into dedicated ImportSelector and make use of String based class names to avoid cyclic dependencies between the config packages.

Removed BasicLinkBuilder.
2019-02-21 12:27:51 +01:00
Oliver Drotbohm
68c605c7ff #728 - Polishing.
Adapt to API changes in master branch. Fixed formatting.
2019-02-21 12:27:51 +01:00
Greg Turnquist
3f0dcc7cb4 #728 - Add support for Spring WebFlux.
* Render hypermedia from WebFlux controllers.
* Support consuming hypermedia through WebClient.
* Support link creation reactively with a custom filter and explicitly with a user-provided ServerWebExchange.
* Add a ReactiveResourceAssembler and SimpleReactiveResourceAssembler.
* Upgrade to Spring Framework 5.2 to align with Spring Data Moore, removing specialized Forwarded header handling.
2019-02-21 12:27:51 +01:00
Oliver Drotbohm
0ec193fa26 #798 - Polishing.
Switched to javadoc:javadoc goal as we're not an aggregator project and can prevent the lifecycle restart from being triggered which caused plugins being bound to lifecycle phases before compile to be re-triggered.

Upgraded to Asciidoctor Maven Plugin 1.5.7.1.
2019-02-21 09:52:38 +01:00
Oliver Drotbohm
544d7cd9ff #749 - Polishing. 2019-02-20 22:55:56 +01:00
Oliver Drotbohm
112479c499 #749 - Improve performance in Link building.
Introduced more aggressive caching of request mappings and UriTemplates based on the contribution on 0.25.x.
2019-02-20 22:55:48 +01:00
Oliver Drotbohm
926bf55339 #825 - Polishing.
Added StringLinkRelation.hashCode() to be consistent with ….equals(…).

Original pull request: #826.
2019-02-20 17:33:36 +01:00
Greg Turnquist
19036880b4 #825 - Comply with RFC8288 for LinkRelation matching.
Added several tests to ensure compliance with RFC8288.

Original pull request: #826.
2019-02-20 17:33:02 +01:00
Oliver Drotbohm
9131a82b90 #808 - Removed build setup after Spring 5.1 upgrade. 2019-02-15 11:46:46 +01:00
Greg Turnquist
e74d1098cc #808 - Remove Forwarded handling.
In light of upgrading to Spring Framework 5.1, no longer need custom handling of Forwarded headers.

Original pull request: #818.
2019-02-15 11:21:39 +01:00
Oliver Drotbohm
9e5db1874e #812 - General overhaul and refactorings.
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.
2019-02-15 10:57:23 +01:00
Oliver Drotbohm
38b98af786 #819 - Polishing.
Original pull request: #820.
2019-02-15 10:53:20 +01:00
Greg Turnquist
14f0012aef #819 - Migrate off deprecated OrderAwarePluginRegistry APIs.
Original pull request: #820.
2019-02-15 10:52:50 +01:00
Oliver Drotbohm
ee12040f10 #813 - Upgrade to Kotlin 1.3.21. 2019-02-14 19:20:35 +01:00
Oliver Drotbohm
eb78f47e4f #808 - Upgrade to Spring Framework 5.1.5. 2019-02-14 19:20:17 +01:00
Greg Turnquist
a447d2b5ce #804 - Polishing. 2019-02-11 12:42:46 -06:00
Oliver Drotbohm
baa2ca7d24 #807 - Removed console output from UberWebMvcIntegrationTest. 2019-02-11 14:59:17 +01:00
Oliver Drotbohm
f830d3d641 #806 - Polishing. 2019-02-11 14:57:31 +01:00
Oliver Drotbohm
aca2cc578a #806 - Fixed package cycle between hateoas and hateoas.core packages.
Moved AffordanceModelFactory to the library's root package. Moved Kotlin extensions to hateoas.mvc package.

Added an ArchUnit based test for package cycles.
2019-02-11 14:57:25 +01:00
Oliver Drotbohm
e794bf873a #805 - Polishing.
Whitespace.
2019-02-11 10:41:49 +01:00
Oliver Drotbohm
1dea5f61b9 #805 - Added Links.getRequiredLink(…). 2019-02-11 10:41:49 +01:00
Greg Turnquist
a9bae74dcf #793 - Switch from @Order to Ordered. 2019-02-07 16:44:42 -06:00
Oliver Drotbohm
ca72790b4b #804 - Avoid log output in MultiMediaTypeWebMvcIntegrationTests. 2019-02-07 20:21:41 +01:00
Oliver Drotbohm
c0903cb33e #803 - Polishing.
Method reordering. Whitespace.
2019-02-07 20:13:23 +01:00
Oliver Drotbohm
df6e1e5989 #803 - Removed reflective bridging between JSONPath 0.9 and 1.0.
We're on JSONPath 2.2 already.
2019-02-07 20:12:21 +01:00
Greg Turnquist
9e8e57a74b #787 - Return all Link attributes on discovery. 2019-02-07 11:42:08 -06:00
Greg Turnquist
9518a2db9a #791 - Add 'name' property to Link. (#801) 2019-02-07 08:13:49 -06:00
Greg Turnquist
9590d1f9ef #798 - Polishing. 2019-02-06 10:31:52 -06:00
Jay Bryant
a483daab6d #798 - Modernize documentation production and appearance.
Applied new convention standard for generating documentation using spring-doc-resources.
2019-02-06 10:26:48 -06:00