Commit Graph

226 Commits

Author SHA1 Message Date
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
Kulcsár Roland
483f8479bd #580 - Update IANA relation types
Per https://www.iana.org/assignments/link-relations/link-relations.xhtml, the list of standardized IANA rels has grown.
2017-05-17 11:11:26 -05:00
Oliver Gierke
6bed9bec40 #583 - Updated Jackson version to 2.9.0.pr for Spring 5 compatibility in build profile.
Fixed super constructor invocation to avoid NullPointerException in super class.
2017-05-16 13:33:27 +02:00
Oliver Gierke
d68700231e #582 - LinkBuilder now makes sure appended path is considered path segment.
We now prepend the given path (and query) handed to LinkBuilderSupport.slash(…) to make sure calls to UriComponentsBuilder.fromUriString(…) always considers the given value as path. Previously, a value containing a colon caused problems as the regex to detect scheme and port would accidentally match.

Related ticket: https://jira.spring.io/browse/DATAREST-1074
2017-05-16 13:13:52 +02:00
Greg Turnquist
1d1f1cffda #558 - Fix attempted double registration of message converters.
Original pull request: #568
2017-04-06 00:01:40 +02:00
Greg Turnquist
aafe1f2d63 #566 - Introduced ResourceSupport.getLinks(…) to return all with a given rel.
Related tickets: #542, #318, #319, #157.
2017-03-26 11:19:15 +02:00
Greg Turnquist
9f875b211b #562 - Clean up JavaDocs by removing references to downstream methods.
Putting in links to downstream methods (Spring Data Commons PagedResourcesAssembler.addPaginationLinks(…)) is not advisable.

Related ticket: #501.
2017-03-26 11:14:36 +02:00
Johnny Lim
2598370164 #561 - Fix typos in Javadoc of Traverson. 2017-03-26 11:13:49 +02:00
Christoph Strobl
a16ea77c15 #536 - Remove references to Assert single-arg methods.
Remove usage of calls to single-argument assertion methods by providing message.

Original pull request: #537.
2017-01-31 17:56:14 +01:00
Oliver Gierke
fb0ba255a6 #527 - Revert a glitch introduced in move to Spring's UriComponentsBuilder API.
Our migration to the header handling for #509 (47cefe) unfortunately moved from starting with the servlet mapping for URI creation to using the full URI from the start.

This is now fixed by switching back by creating a UriComponentsBuilder from the current servlet mapping.

Related ticket: #509.
2016-12-22 12:08:32 +01:00
Oliver Gierke
d1ebe04d49 #520 - Polishing in RequestParamParameterAccessor. 2016-12-08 10:50:07 +01:00
Oliver Gierke
89323d0baf #520 - Polished a couple of SonarQube warnings. 2016-12-08 10:29:24 +01:00
Oliver Gierke
327e2cda76 #509 - Polishing.
Formatting and author note.

Original pull request: #519.
2016-12-07 16:56:07 +01:00
Oliver Trosien
47cefe6869 #509 - Align ControllerLinkBuilder's base URI generation with Spring Framework.
Removed the custom handling of proxy headers in ControllerLinkBuilder in favor of the behavior of UriComponentsBuilder in Spring Framework. The only thing that we keep custom is the handling of X-Forwarded-Ssl as it's rather non-standard.

Original pull request: #519.
2016-12-07 16:54:17 +01:00
Oliver Gierke
267181ba44 #511 - Caching UriTemplate instances for discovered mappings now. 2016-12-07 12:16:49 +01:00
Oliver Gierke
2daf8aabfb #169 - Added support for creating URI templates by pointing to controller methods.
If not all parameters are handed to a fake controller method invocation, the resulting link is now becoming a URI template. That means there are some tiny changes to the general behavior:

1. Missing required parts (like a path segment) are not rejected immediately but only if the resulting link is expanded itself.
2. Missing request parameters now appear in the resulting link, either in mandatory form (e.g. ?foo={foo}) or optionally (e.g. /{?foo}). To resolve these, the Link has to be expanded in turn.
2016-12-07 12:08:05 +01:00
Oliver Gierke
4838e9f40c #511 - Performance improvements in link building.
We're now caching meta information about controller methods and their parameters more aggressively to avoid repeated lookups of such information via reflection. We're also keeping reference to proxy classes generated through CGlib around to avoid costly regeneration.

Note that the main culprit causing the drastic numbers reported in the original ticket stem from a problem in Spring's TypeDescriptor which triggers costly equals(…) comparisons on synthesized annotations [0].

Removed conditional reflective lookup of DefaultParameterNameDiscoverer as it's now present by definition.

[0] https://jira.spring.io/browse/SPR-14926
2016-11-21 12:54:57 +01:00