Commit Graph

255 Commits

Author SHA1 Message Date
Greg Turnquist
5725794a8e #788 - Remove redundant constructs, pre-Java 8 cruft, and superfluous exceptions. 2019-01-18 11:38:19 -06:00
Greg Turnquist
e9074c5d52 #784 - Polishing.
* Formatting.
* Copyright headers.
* Unused/unneeded methods.
2019-01-15 12:12:05 -06:00
Jens Schauder
b7a1c06f79 #784 - Polishing.
* Formatting.
* Extracted conversion methods.
* Tested and fixed NPE with empty pojo.
* Tested and fixed NPE with empty page meta data.
2019-01-15 12:10:47 -06:00
Greg Turnquist
8da3a851ce #784 - Introduce UBER+JSON mediatype.
Based on https://rawgit.com/uber-hypermedia/specification/master/uber-hypermedia.html.
2019-01-09 14:33:41 -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
26c9a3d71e #483 - Polishing.
Since we can't guarantee the incoming Map is <String,Object>, should only cast as <Object,Object> and use `.toString()` for maximum flexibility.
2018-12-21 08:43:21 -06:00
JamesE Richardson
8ced6c5154 #483 - Add composite field support to UriTemplate.
* 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
2018-12-20 20:27:56 -06:00
Greg Turnquist
a56392ac7c #572 - Create SimpleResourceAssembler for Resource<T>.
Implement a ResourceAssembler based solely on a domain type, returning Resource<T> for the `toResource(obj)` method.

Related issues: #416
2018-12-19 11:36:40 -06:00
Greg Turnquist
a597960711 #416 - Alter ResourceAssemblerSupport.toResources to return Resources.
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
2018-12-18 10:28:03 -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
Johnny Lim
ca0263fc5a #751 - Align Hop header assertions with HttpHeaders and javadocs.
Spring Framework accepts `null` for header values in HttpHeaders. This is already reflected in the javadocs.
2018-12-07 11:41:10 -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
Oliver Drotbohm
eff893fcf8 #758 - Polishing.
Original pull request: #717.
2018-12-06 14:21:10 +01:00
Greg Turnquist
bb4a4a615c #758 - Centralize all Forward header handling.
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.
2018-12-06 14:20:54 +01:00
Greg Turnquist
df618efd12 #743 - Polishing. 2018-10-25 11:54:25 -05:00
Manish Misra
b60799d7fa #743 - Allow custom headers on each hop. 2018-10-25 11:39:15 -05:00
Oliver Gierke
8cfbfc1b89 #719 - Simplified configuration setup.
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.
2018-06-22 11:30:16 +02:00
Greg Turnquist
ef3e3c48fe #711 - Polishing. 2018-05-15 15:08:35 -05:00
Greg Turnquist
8f15301220 #711 - Upgrade to Spring Framework 5.0.6.RELEASE. 2018-05-15 15:06:34 -05: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
Greg Turnquist
3af698d928 #700 - Remove JAX-RS support. 2018-04-18 16:34:35 +02:00
Greg Turnquist
22bd76db49 #665 - Fix ALPS format.
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.
2018-04-18 16:28:49 +02:00
Jeffrey Walraven
ba1dae383c #699 - Render additional RFC5988 attributions in HAL. 2018-02-19 13:39:51 -06:00
Christian Bühler
21719bb041 #686 - Support whitespace in Links header (RFC 5988).
RFC 5988 (https://tools.ietf.org/html/rfc5988#section-5.5) has clear examples of whitespace in link headers. This commit introduces support (and tests) to support these spec cases.
2018-01-03 13:50:25 -06:00
Johnny Lim
13db7c7fb2 #685 - Polishing.
Remove merge conflict messages.
2017-12-31 13:17:54 -06:00
Oliver Gierke
32ff7cc576 #340 - Polishing.
More Java 8 related cleanups (diamond operator etc.).
2017-11-29 12:59:59 +01:00
Greg Turnquist
fed5f6c313 #340 - Patch ALPS serialization property order.
Side effect of upgrading Jackson appears to be arbitrary change in order of property serialization. This commit forces the order to match the spec and fixes the related test cases.
2017-11-29 12:59:59 +01: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
Johnny Lim
d40bda2337 #671 - Remove list creation in ResourceSupport.getLink().
Since `ResourceSupport` has direct access to the list of links, no need to build up an intermedia `List` and then filter on it. Simply filter on the internal list of links. Also did some minor polishing.
2017-11-15 10:34:04 -06:00
Maciej Walkowiak
6d952b1abf #655 - Replace Java8Utils by utilizing Spring 5's Optional support.
Since the baseline for the next version is Java 8 there is no need to check if Optionals are on the classpath.

Original pull request: #657.
2017-10-30 13:13:12 +01:00
Kulcsár Roland
cf3ab53b5a #658 - Remove unused Enhancer variable in DummyInvocationUtils. 2017-10-30 12:40:36 +01:00
Oliver Gierke
b217b6a4ab #653 - Polishing.
Consistently add // at manually separated stream steps.
2017-10-16 17:59:33 +02:00
Oliver Gierke
d9c53b5eeb #653 - Polishing.
Expose nullability in Identifiable, ResourceSupport and Links via Optional.
2017-10-16 17:58:55 +02:00
Kulcsár Roland
4c7227e274 #653 - Use Java 8 Stream API. 2017-10-16 17:40:37 +02:00
Oliver Gierke
7a5b7b1c9f #652 - Moved off Jackson 2.9 deprecations. 2017-10-15 09:25:24 +02:00
Oliver Gierke
e412bbb7f0 #649 - Polishing.
Related ticket: #642.
2017-10-15 09:16:09 +02:00
Kulcsár Roland
7570b003d1 #649 - Use Java 8 Map enhancements.
Related ticket: #642.
2017-10-15 09:15:45 +02:00
Oliver Gierke
35033fee0e #647 - Switch to AssertJ and upgrade to Mockito 2. 2017-10-14 00:59:54 +02:00
Oliver Gierke
aaddb8fc55 #645 - Upgraded to Spring Plugin 2.0. 2017-10-14 00:59:18 +02:00
Oliver Gierke
d5e719825f #288 - Polishing.
Moved RenderSingleLinks enum into HalConfiguration. Simplified HalConfiguration setup by moving the default into the class. The lookup of a user-provided HalConfiguration is now handled on the bean name level to avoid premature initialization of a potentially defined bean. Formatting.

Original pull request: #295
Related issues: #291
2017-10-13 14:47:09 +02:00
Greg Turnquist
5eee30127d #288 - Introduced HalConfiguration to allow customizations of rendering options.
We now expose HalConfiguration to be defined as Spring bean in user configuration to control certain aspects of the HAL rendering. Initially we allow to control whether links shall always be rendered as collection. If no user-provided bean is available, we register a default instance.

Original pull request: #295
Related issues: #291
2017-10-13 14:30:16 +02:00
Kulcsár Roland
ab54e56f01 #638 - Fix typos in Javadoc. 2017-10-13 12:27:32 +02:00
Greg Turnquist
5faf9858bb #617 - AnnotatedParametersParameterAccessor now considers @AliasFor declarations.
We're now using SynthesizingMethodParameter to correctly support annotation attributes that use @AliasFor.

Original pull request: #621.
2017-10-13 11:43:08 +02:00