Commit Graph

242 Commits

Author SHA1 Message Date
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
Oliver Gierke
4ad8c3b9aa #639 - Polishing.
Formatting and nullability in JavaDoc.
2017-10-05 15:28:21 +02:00
Oliver Gierke
ed7e430628 #639 - Added support for Optional controller method parameters in ControllerLinkBuilder.
We now properly consider Optional controller method parameters and correctly map its values to URIs created and optionality of the parameter derived.
2017-10-05 15:28:21 +02:00
Oliver Gierke
8623106bb7 #597 - Polishing.
Formatting. Simplified resource loading in tests. Added missing line feed to ALPS sample file.
2017-09-07 13:49:14 +02:00
Greg Turnquist
b0820011e8 #597 - Add ALPS media type and LinkDiscoverer.
Migrate general ALPS material from Spring Data REST into Spring HATEOAS.
2017-09-07 13:48:37 +02:00
Oliver Gierke
312134ee82 #470 - Added HAL JSON UTF-8 variant to MediaTypes.
Added application/hal+json;charset=UTF-8 to the media types enum. Traverson now configures all HAL flavors to be supported by the registered HAL-specific HttpMessageConverter.

Removed nullability of media type in JsonPathLinkDiscoverer. This requires subclasses that want to support all media types to explicitly configure MediaType.ALL.

Heavily inspired by the PR submitted by @drummond but very significantly rewritten.
2017-09-07 13:37:59 +02: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
Oliver Gierke
af3ec1a242 #408 - Polishing.
Original pull-request: #410.
Related issues: #330, #143, #516.
2017-07-27 19:04:50 +02:00
Greg Turnquist
b346366f73 #408 - Form relative links when outside a Spring web request
If forming a link outside a Spring web request, fallback to relative links.

Original pull-request: #410.
Related issues: #330, #143, #516.
2017-07-27 19:04:30 +02:00
Oliver Gierke
c784df964e #594 - Polishing.
Rather use early return for null annotation instead of conditional lookup.

Original pull request: #595.
2017-07-27 17:18:17 +02:00
Greg Turnquist
14a5a79490 #594 - Protect against Spring 5 non-null inputs.
Spring 5 has adopted a "no nulls" policy that causes certain methods to throw exceptions instead of returning a null. This updates Spring HATEOAS to handle it suitably.

Original pull request: #595.
2017-07-27 17:18:15 +02:00
Kulcsár Roland
82fb6ef9d2 #603 - Fix typos 2017-07-13 13:37:37 -05:00
Kulcsár Roland
31c8b218b5 #600 - Fix typo in UriTemplate 2017-06-13 14:27:04 -05:00