Commit Graph

27 Commits

Author SHA1 Message Date
Greg Turnquist
4081e58a1f #788 - Switch to IanaLinkRelations internally. 2019-01-18 12:19:25 -06:00
Greg Turnquist
0f696dd637 #788 - Remove redundant generics. 2019-01-18 12:03:45 -06:00
Greg Turnquist
74647cb5b1 #788 - Unify line endings. 2019-01-18 11:38:28 -06:00
Greg Turnquist
820f66179f #707 - Refactor Affordances to better support Spring Data REST.
* 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.
2019-01-07 14:08:42 -06:00
Greg Turnquist
2e7eabdc1a #778 - Introduce LinkRelation and enumerated IANA types.
Include IANA registry text and link to related standard for each link relation.
2019-01-04 12:42:32 -06:00
Greg Turnquist
8bf01c3ee5 #667 - Ignore unknown properties in LinkMixin.
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
2018-12-10 08:04:14 -06:00
Jens Schauder
4ce73154df #678 - Polishing.
* 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.
2018-12-07 12:26:25 -06:00
Greg Turnquist
6f27ff0379 #678 - Add 'profile' to Link.
Fully support HAL spec by adding "profile" as another optional attribute to `Link`.

See: https://tools.ietf.org/html/draft-kelly-json-hal-08, https://tools.ietf.org/html/rfc5988
2018-12-07 12:26:25 -06:00
Greg Turnquist
d5649c0de1 #667 - Fix Link to ignore setting "templated" properties.
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..
2018-12-06 12:54:28 -06:00
Jens Schauder
367f560745 #695 - Polishing.
* Removed Jaxb annotations from packaga-info.java.
* Simplified Test code by removing unused code a debug output.
* Formatting.
* Updated copyright headers.
2018-12-06 12:25:22 -06:00
Greg Turnquist
dca65e15f8 #695 - Remove Jaxb annotations.
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.
2018-12-06 12:00:44 -06:00
Greg Turnquist
d6e02857f1 #482 - Add support for Collection+JSON mediatype.
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.
2018-04-18 16:44:15 +02:00
Oliver Gierke
092ceb987f #340 - Polishing.
Moved AffordanceModelFactory into core package as it's SPI. Switched to Spring Factories lookup of implementation classes so that we avoid a package dependency between the MVC package and the media type specific packages. Removed reference to MediaType from AffordanceModelFactory to AffordanceModel so that a factory can even provide models for different MediaTypes (i.e. different flavors of the same one, e.g. HAL Forms for JSON and XML). Also removed addAffordanceModel(…) from Affordance to not force the implementations into mutability. Made most of the affordance building API types package protected. HalFormsAffordanceModel now uses MethodParameters abstraction to simplify model parsing code.

Tweaked HAL forms model to work with factory methods for required properties and wither methods to add optional properties. Tweaked and inlined mixin types in Jackson module for HAL forms.

Slight API polishing on Link to make sure Affordance collecting methods are not named with….

Tweaked Lombok setup to use all caps for logger constants. Removed deprecation warnings in Jackson2HalModule.
2017-11-29 12:59:58 +01:00
Greg Turnquist
70448a8540 #340 - Add new Affordances API + HAL-FORMS mediatype.
* Introduces new Affordances API to build links related to each other to serve other mediatypes
* Introduces HAL-FORMS, which uses affordances to automatically generate HTML form data based on Spring MVC annotations.

Original pull-request: #340, #447, #581
Related issues: #503, #334, #71
2017-11-29 12:59:58 +01:00
Oliver Gierke
79ebf9b5a4 #671 - Polishing.
Introduced Link.hasRel(…) and use that to filter link lookups in ResourceSupport.
2017-11-29 12:00:02 +01:00
Oliver Gierke
05f687ef39 #567 - Polishing.
Field annotations inline. Formatting.
2017-07-28 09:45:04 +02:00
Greg Turnquist
891fd90f5a #567 - Add extra attributes to Link and use for HAL mediatype.
Adds many additional attributes defined in RFC5988 and verifies they work properly in the neutral representation of Link while also being rendered properly in the HAL module.

Related tickets: #100, #417, #235
Previous pull requests: #240, #238, #223, #79
2017-07-28 09:44:55 +02:00
Kulcsár Roland
82fb6ef9d2 #603 - Fix typos 2017-07-13 13:37:37 -05:00
Oliver Gierke
1f57378b84 #504 - Parsing links now supports all rel formats defined in RFC5988. 2016-10-28 11:30:00 +02:00
Oliver Gierke
8436e9ed4e #165 - Removed support for Jackson 1.x. 2014-03-21 17:45:58 +01:00
Oliver Gierke
c790a5d834 #137 - Changed Link.isTempalte() to isTemplated(). 2014-01-23 11:46:08 +01:00
Oliver Gierke
3c62de720f #137 - Improved Link and UriTemplate API.
Added constructor to Link to take a UriTemplate. Added constructor to UriTemplate to take a base URI and TemplateVariables.
2014-01-21 14:27:23 +01:00
Oliver Gierke
b0cfaf7a62 #137 - Extracted TemplateVariable into separate class.
TempalteVariable is now a standalone class. Introduced TempalteVariables wrapper to allow easy collecting of TempalteVariable instances and rendering them in the shortest possible way.
2014-01-21 13:12:47 +01:00
Oliver Gierke
6e9caf2556 #137 - Merged Link and LinkTemplate.
Link now exposes additional methods like isTemplate(), getTemplateVariables() and expand(…).
2014-01-19 18:38:53 +01:00
Oliver Gierke
a9ccfc6782 #64 - Extended support for PagedResources.
Changed Relation type to identify previous links to standardized value of prev. Added integration tests for HAL rendering of PagedResources.
2013-05-16 00:07:57 +02:00
Oliver Gierke
d152bcb7d1 #54 - Added support for RFC5988 link headers.
Introduced new Links container element to group a list of links and allow parsing an RFC5988 compatible String representation of links into it. The parsing mechanism is currently regarding the rel attribute only.

Added valueOf(…) factory methods to allow Spring MVC to pick the types up out of the box.
2013-02-20 14:44:08 +01:00
Oliver Gierke
21b1a4ec8c Initial commit. 2012-05-10 20:25:31 +02:00