Commit Graph

197 Commits

Author SHA1 Message Date
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
Oliver Gierke
1f57378b84 #504 - Parsing links now supports all rel formats defined in RFC5988. 2016-10-28 11:30:00 +02:00
Michael Hibay
a473943be4 #499 - Adding id property to Ext to conform to ALPS spec.
Adapted unit tests to include the additional field.

Original pull request: #500.
2016-10-28 09:50:53 +02:00
Oliver Gierke
d8b7dcbca1 #471 - Polishing.
Fixed imports and reinstantiated old unit test to make sure we actually test both scenarios.

Original pull request: #497.
2016-10-28 09:43:23 +02:00
Mark Paluch
a7f8a2c698 #471 -Support composed annotations in AnnotationMappingDiscoverer.
We now support composed annotations using @AliasFor such as @GetMapping that are mixed with @RequestMapping on type and method level.

@RequestMapping("type")
class MyController {

	@GetMapping("method")
	String method() {
	   …
	}
}

Original pull request: #497.
2016-10-28 09:38:49 +02:00
Oliver Gierke
642b673676 #486 - Fixed assignment checks of ResolvableTypes for wildcarded method return types.
ResourceProcessorInvoker suffered from Spring's ResolvableType.fromClass(…) using strong assignability checks between raw types and wildcarded right hand side types (i.e. Collection VS. Collection<?>). This has been reported [0] and fixed already but we have to switch to ResolvableType.fromRawClass(…) to get the desired assignment check behavior.

Tightened unit tests to verify the calls to the delegate handler, which had been disabled by accident and thus prevented us from detecting the issue with ResolvableType beforehand.

[0] https://jira.spring.io/browse/SPR-14648
2016-08-31 17:08:15 +02:00
Oliver Gierke
266ad50b35 #469 - Removed support for AnnotationMethodHandlerAdapter.
Added a Spring 5 specific build profile and removed the references to AnnotationMethodHandlerAdapter which already had been deprecated in the latest Spring 3 in favor of RequestMappingHandlerAdapter.

Updated Spring build profiles in general.
2016-07-25 20:32:27 +02:00
Oliver Gierke
0331b8d2c7 #460 - HalHandlerInstantiator now uses a BeanFactory for all non pre-registered types.
The HalHandlerInstantiator now accepts an AutowireCapableBeanFactory to delegate component creation requests to for non pre-build serializers. This allows other serializers to benefit from Spring instantiation but at the same time use the dedicated serializers created as singletons.
2016-06-09 17:20:27 +02:00
Oliver Gierke
cbbc2b2d84 #440 - Links now parses URIs containing commas correctly.
Switched to a regular expression based split of links to make sure URIs that contain commas do not interfere with the rather simplified splitting algorithm we used before.
2016-06-06 11:47:24 +02:00
Oliver Gierke
4d189cf11f #457 - Polished usage of Lombok in ALPS package.
Switched to the non-experimental @Builder. Upgraded to Lombok 1.16.8.
2016-06-06 11:26:59 +02:00
Oliver Gierke
40898cb1ea #362 - Moved ResourceProcessor invoking infrastructure from Spring Data REST. 2016-06-06 11:25:19 +02:00
Oliver Gierke
28687af228 #455 - More removals of deprecations in ResourcesMixin. 2016-05-20 18:42:02 +02:00
Oliver Gierke
33ad2e0947 #455 - Adapt Jackson2HalModule to assure Jackson 2.7 compatibility.
Changed invocations of constructors of the super class in Jackson Serializers to use JavaType instead of Class<?> as the constructor has been removed in some of the base classes in Jackson 2.7.

Upgraded to Jackson 2.5.5 along the way.
2016-05-20 14:12:34 +02:00
Oliver Gierke
3dc7aac35c #372 - Polishing.
Updated authors and copyright years, some minor refactorings.
2016-01-13 18:45:16 +01:00
Andrew Naydyonock
23a9017214 #372 - Added support for Map parameters to LinkBuilderFactory.linkTo(…). 2016-01-13 18:44:27 +01:00
Oliver Gierke
911bec4bd6 #186 - AnnotationMappingDiscoverer now uses first mapping in case multiple ones are defined. 2016-01-12 10:56:33 +01:00
Oliver Gierke
e1afab94de #269 - Polishing.
Simplified slash removal and made sure slashes occuring multiple times are removed properly.

Original pull request: #423.
2016-01-12 09:51:45 +01:00
Kevin Conaway
720ff797de #269 - Make sure URL parts are joined by exactly one slash.
Original pull request: #423.
2016-01-12 09:49:29 +01:00
Oliver Gierke
792b5fcd22 #398 - Polishing.
Some JavaDoc, formatting, copyright year expansion and author tags. Test method ordering.

Original pull request: #422.
2016-01-07 18:58:32 +01:00
Kevin Conaway
7174015746 #398 - Remove unnecessary URI conversion in ControllerLinkBuilderFactory.
ControllerLinkBuilderFactory now forwards the source UriComponents to the ControllerLinkBuilder instead of turning it into a URI and a UriComponentsBuilder in turn.

Original pull request: #422.
2016-01-07 18:57:21 +01:00
Oliver Gierke
dd0f9e8905 #421 - DefaultCurieProvider now automatically prefixes URIs in case they're not absolute.
DefaultCurieProvider now automatically adds the application URI (servlet mapping) in case the UriTemplate configured does not contain an absolute URI in the first place.
2016-01-04 17:17:14 +01:00
Oliver Gierke
4e1e5ed934 #383 - Reinstantiated Jackson 2.4 compatibility.
Re-introduced the simple isEmpty(…) methods in custom Jackson serializers as the more complex ones were introduced in Jackson 2.5 only. Removed the @Override annotations so that we could even compile against 2.4 if needed.
2015-09-03 14:19:03 +02:00
Tom Bunting
dd4ec341b5 #337 - Fixed potential double-encoding in Traverson.
We now avoid calling URI.toString() to early to prevent the need to re-parse it and thus accidentally cause a double-encoding.

Original pull request: #382.
2015-09-03 12:39:04 +02:00
Oliver Gierke
71ec26fc8d #378 - HAL links get title attributes rendered resolved through a resource bundle.
HalLinkListSerializer now tries to obtain a link title by looking up key _links.$rel.title for both the namespaced (curied) and local link relation if the former doesn't resolve into a message.
2015-08-19 19:07:07 +02:00
Oliver Gierke
d77a4b65f5 #320 - Overhaul in curie rendering.
The curie rendering has been improved in the following ways:

- Resources now get their embeds inspected for namespaced keys and curies are added if at least one is found. This makes sure curies are also rendered if no namespaced link is registered.
- Nested resources skip curies entirely, assuming they have been added to the root correctly.

Had to change the order of _embedded and _links to make sure the embedded elements are processed first to tweak the links to indicate the need for curies.
2015-08-19 16:35:04 +02:00
Oliver Gierke
d8cc666703 #363 - Extended DefaultCurieProvider to be able to configure multiple curies.
DefaultCurieProvider now also takes a Map<String, UriTemplate> to expose multiple curies. The default curie to be used to expand unprefixed, non-IANA link relations has to be defined explicitly in case more than one curie is if given. If there's only one, that becomes the default, too.
2015-08-13 21:31:17 +02:00
Oliver Gierke
dcf692cbdb #375 - Fixed is-empty evaluation for TrueOnlyBooleanSerializer on Jackson 2.6.
Added missing override for isEmpty(…) that gets used by Jackson 2.6+ to prevent { templated : false } get rendered in HAL link representations.

Polished Javadoc on the way.
2015-08-11 21:17:20 +02:00
Przemek Nowak
2cec9982b5 #247 - Added HAL_JSON_VALUE in MediaTypes.
Original pull request: #329.
2015-08-04 10:56:19 +02:00
Oliver Gierke
e9d83c5c48 #369 - Traverson no defensively expands URIs handed to getAndFindLinkWithRel(…). 2015-08-04 10:35:44 +02:00
Oliver Gierke
07a5620d9f #368 - Assert Jackson 2.6.0 compatibility.
Switched from overrides of the deprecated (and removed in 2.6) isEmpty(T) to isEmpty(SerializerProvider, T). Switched from deprecated @JsonSerialize(include = …) to the dedicated @JsonInclude annotation.
2015-08-04 10:35:44 +02:00