Commit Graph

36 Commits

Author SHA1 Message Date
Oliver Drotbohm
39404ea2d9 #977 - Performance improvements in link generation.
Introduced more caches for reusable value objects: UriTemplate, MethodParameters. Cache UriTemplate.toString() to avoid re-computation. Avoid recomputing the affordances if possible in WebHandler. Removed cache in AnnotatedParametersParameterAccessor as that one now transitively benefits from the one introduced in MethodParameters.

Related ticket: spring-projects/spring-framework#22730.
2019-04-03 18:39:40 +02:00
Spring Operator
0e02d4f041 #910 - URL cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 2 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 268 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-22 17:32:52 +01:00
Oliver Drotbohm
75ad0988cd #831 - Polishing.
Significant rework of the nullability annotation introduction to not produce any warnings anymore. Added nullability annotations where still missing. Removed the ones that were added erroneously.

Tightened nullability contracts in a couple of places, most prominently LinkRelationProvider, that now uses a LookupContext as plugin delimiter so that implementations can selectively be looked up for item or collection link relation lookup.

Removed obsolete declaration of Findbugs dependency.
2019-03-20 00:15:35 +01:00
Greg Turnquist
520fdc8d91 #831 - Polishing. 2019-03-11 17:35:20 -05:00
Greg Turnquist
40250d1738 #831 - Introduce null handling. 2019-03-08 13:21:21 -06:00
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
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
Greg Turnquist
9518a2db9a #791 - Add 'name' property to Link. (#801) 2019-02-07 08:13:49 -06:00
Jens Schauder
9f4f1ad79b #788 - Fixed obvious warning in all touched files.
* Fixed assertions.
* Removed superfluous code.
* Simplified generics.
* Formatting.
2019-01-23 13:59:21 -06:00
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