Commit Graph

39 Commits

Author SHA1 Message Date
Oliver Drotbohm
0d25b2e66e #1169 - Update copyright years to 2020. 2020-01-10 12:26:41 +01:00
Greg Turnquist
fff5396a1c #1059 - Cleanup the core codebase.
Clean up code containing various patterns:

* Remove redundant `final`, `public`, and `static` declarations in interfaces and enums.
* Replace redundant `? extends Object` generic parameters with `?`.
* Convert collections to arrays using empty array instead of pre-sized one (modern JVM recommendation).
* Initialize collections using constructor call over `addAll`.
* Favor `addAll` over iterating and adding one-by-one.
* Take advantage of `Map.forEach` that was introduced with Java 8.
2019-08-30 17:43:07 -05:00
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
Greg Turnquist
f9a0c0fb13 #971 - Polishing. 2019-04-02 13:08:54 -05: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
122391e60d #831 - Polishing. 2019-03-11 23:23:36 -05:00
Greg Turnquist
520fdc8d91 #831 - Polishing. 2019-03-11 17:35:20 -05:00
Jens Schauder
bdd602aa74 #831 - Polishing.
Applied some recommendations provided by IntelliJ that I stumbled over while reviewing the changes.
2019-03-11 18:06:15 +01:00
Greg Turnquist
40250d1738 #831 - Introduce null handling. 2019-03-08 13:21:21 -06:00
Oliver Drotbohm
4b08aa783e #850 - Polishing.
Moved to factory methods on PluginRegistry.
2019-03-05 14:20:07 +01:00
Oliver Drotbohm
81af032810 #840 - LinkDiscoverer now exposes methods to lookup required links.
Introduced findRequiredLinkWithRel(…) methods on LinkDiscoverer to delegate to existing lookups but resolving the Optional into an IllegalArgumentException.

Fixed JsonPathLinkDiscoverer to return no links at all if a required path segment in the payload cannot be found which would have triggered a PathNotFoundException before.

Polished parameter names and JavaDoc. Moved base test cases into the right packages.
2019-02-28 17:00:35 +01:00
Oliver Drotbohm
57f36a58db #833 - Migrate packages.
Changed the package structure to better reflect the different modules of the library. All client related code now lives in the client package, server related APIs in server with their respective WebMVC and WebFlux implementations in sub-packages.

Added migration script to allow users to easily migrate to the new structure and added reference documentation section on the migration.

Traversons built in defaulting to HAL HttpMessageConverters and LinkDiscoverer implementation now caused a cyclic relationship between the client and mediatype.hal packages. This has be fixed by looking up the defaults via a SpringFactories interface.
2019-02-27 12:59:58 +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
Oliver Drotbohm
38b98af786 #819 - Polishing.
Original pull request: #820.
2019-02-15 10:53:20 +01:00
Greg Turnquist
14f0012aef #819 - Migrate off deprecated OrderAwarePluginRegistry APIs.
Original pull request: #820.
2019-02-15 10:52:50 +01:00
Greg Turnquist
0f696dd637 #788 - Remove redundant generics. 2019-01-18 12:03:45 -06:00
Greg Turnquist
5725794a8e #788 - Remove redundant constructs, pre-Java 8 cruft, and superfluous exceptions. 2019-01-18 11:38:19 -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
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
b217b6a4ab #653 - Polishing.
Consistently add // at manually separated stream steps.
2017-10-16 17:59:33 +02:00
Kulcsár Roland
4c7227e274 #653 - Use Java 8 Stream API. 2017-10-16 17:40:37 +02:00
Oliver Gierke
35033fee0e #647 - Switch to AssertJ and upgrade to Mockito 2. 2017-10-14 00:59:54 +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
Johnny Lim
2598370164 #561 - Fix typos in Javadoc of Traverson. 2017-03-26 11:13:49 +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
e9d83c5c48 #369 - Traverson no defensively expands URIs handed to getAndFindLinkWithRel(…). 2015-08-04 10:35:44 +02:00
Oliver Gierke
3b30c7832e #346 - Polishing.
Turned hop into a real value object by making it immutable. Added unit tests for Hop. use verbose concept names instead of abbreviations (e.g. parameters instead of params). Additional assertions and the documentation of such in JavaDoc. @since tag in new Hop class.

Original pull request: #350
2015-05-23 18:50:32 +02:00
Greg Turnquist
2c1797d9b7 #346 - Enhance Traverson.follow() to customize individual hops.
Introduced a dedicated value object to abstract a Hop within a relation traversal. The Hop consists of a relation name and optional local template parameters that are applied to this particular hop when traversing it.

Changed the implementation of Traverson to work with Hops instead of plain rels and merges the global template parameters with the hop-local ones before expanding the templates found.

Original pull request: #350.
2015-05-23 18:47:24 +02:00
Oliver Gierke
1efb5a53bf #310 - Added missing package-info.java files. 2015-02-27 15:03:27 +01:00
Oliver Gierke
912337669a #258 - Traverson now exposes default configuration per media types.
Introduced Traverson.getDefaultMessageConverters(…) to be able to obtain the list of default HttpMessageConverters depending on the given media types. Added overloads for varargs as well as a List for consistency.
2015-02-26 21:25:31 +01:00
Oliver Gierke
78fb2c4bc1 #307 - Introduced TraversalBuilder.asTemplatedLink().
TraversalBuilder.asTemplatedLink() allows to obtain the final link of a hypermedia traversal in unexpanded form.
2015-02-26 19:58:12 +01:00
Oliver Gierke
8fba900aee #212 - Traverson can now return the last link. 2014-07-08 20:59:35 +02:00
Oliver Gierke
a363122be9 #185 - Traverson can now get LinkDiscoverers configured.
Moved to a setter based configuration for both the RestOperations and LinkDiscoverers to be used.

Related pull request: #189.
2014-07-08 20:40:21 +02:00
Dietrich Schulten
c1e940c5f3 #201 - Traverson can now take a customized RestTemplate.
Traverson now has an additional constructor taking a RestOperations instance which will be used instead of the default one. This allows more fine grained control over the HTTP request infrastructure used when performing link traversals.

Some internal polishing (moved from RestTemplate to RestOperations).

Original pull request: #203.
2014-07-08 14:40:27 +02:00
Dietrich Schulten
4f7e1cb561 #187, #188 - Fix header handling in Traverson.
Traverson correctly applies headers when using JsonPath to evaluate GET result: accepts the media types it is configured for and preserves additional headers.
2014-06-04 19:36:54 +02:00
Oliver Gierke
9790d94872 #180 - Overhaul of URI template expansion in Traverson.
We're now consistently using Spring HATEOAS' UriTemplate instead of the Spring MVC one to be able to expand extended template parameters correctly.

Also the ObjectMapper used by Traverson to unmarshal JSON responses does not fail for unknown properties anymore.
2014-05-20 10:33:42 +02:00
Oliver Gierke
0985979428 #131 - Add Traverson hypermedia client API.
Introduce Traverson as means to traverse hypermedia based APIs by providing a set of relation names to discover and follow to access the final representation. Traverson allows to specify a parameter map that will be used  to potentially expand the URIs discovered.

We currently support LinkDiscoverer based relation discovery, which means that relations in HAL representations can be found by simply stating their names. Alternatively JSON path expressions can be used (starting with a $).
2014-05-01 17:47:46 +02:00