Commit Graph

734 Commits

Author SHA1 Message Date
Oliver Drotbohm
fa831ab945 #1887 - Avoid trailing slash for links pointing to empty mapping path. 2023-01-12 09:05:10 +01:00
Oliver Drotbohm
856b6b9cbe #1881 - Fix flaky test. 2022-11-16 18:52:51 +01:00
Oliver Drotbohm
ec7b1b288e #1882 - Switching to Github actions for CI and releases. 2022-11-16 17:35:07 +01:00
Oliver Drotbohm
03aa0a6df7 #1881 - Update changelog. 2022-11-16 12:46:16 +01:00
Oliver Drotbohm
c425f3f355 #1868 - Update changelog. 2022-11-03 23:21:12 +01:00
Oliver Drotbohm
303e03a5b4 #1866, #1867 - More AOT hints from controller methods and RepresentationModelAssemblers.
We now inspect controller method return types and the generics of RepresentationModelAssembler for EntityModel and CollectionModel types and unwrap the type they box to register that for constructor and method invocation reflection.
2022-11-03 23:04:20 +01:00
Oliver Drotbohm
26c1e10f68 #1862 - Update changelog. 2022-10-12 12:58:58 +02:00
Oliver Drotbohm
265f0a1dcc #1857 - Upgrade to Spring Framework 6.0 RC1.
Temporarily disable HypermediaWebClientConfigurerTest due to https://github.com/spring-projects/spring-framework/issues/29307.
2022-10-12 12:20:28 +02:00
Oliver Drotbohm
e018479a4e #1858 - Improved AOT metadata.
We now register proxy types for all controller beans and the return types of their methods if suitable for proxying. This allows the link creation by pointing to controller methods.

We now also register all types (de)serialized by Jackson for reflection.
2022-10-12 11:22:44 +02:00
Oliver Drotbohm
aecea4fd78 #1845 - Update changelog. 2022-09-15 16:26:51 +02:00
Oliver Drotbohm
95ff31d2b5 #1830 - Reset dummy invocation cache on request completion. 2022-09-14 16:54:24 +02:00
Oliver Drotbohm
5b68dbcc40 #1819 - Revert build time initialization for static constants in MediaTypes.
This reverts commit 2804e6d0a7.
2022-09-12 18:14:26 +02:00
Oliver Drotbohm
3f6cb3269c #1822 - Add native runtime hint for the custom serializer in EntityModel. 2022-08-02 14:46:54 +02:00
Oliver Drotbohm
2804e6d0a7 #1819 - Add build time initialization for static constants in MediaTypes. 2022-07-15 17:41:52 +02:00
Oliver Drotbohm
9448e7d276 #1818 - Update changelog. 2022-07-15 14:52:50 +02:00
Oliver Drotbohm
44af5a6b43 #1817 - Improve JavaConfig to work on AOT. 2022-07-15 13:58:42 +02:00
Oliver Drotbohm
c11d21d123 #1814 - Update changelog. 2022-07-14 11:56:14 +02:00
Oliver Drotbohm
0098f2931a #1813 - Tweak integration tests to adapt to changed trailing slash handling in Spring 6.
See [0] for details.

[0] https://github.com/spring-projects/spring-framework/issues/28552
2022-07-14 10:51:38 +02:00
Oliver Drotbohm
42ae74b90d #1800 - Allow dots in template variable names. 2022-06-18 19:15:10 +02:00
Oliver Drotbohm
3dfab2ec03 #1775 - Polishing.
Avoid grouping of template variables via stream.

Before:

Benchmark                          Mode  Cnt      Score      Error  Units
TemplateVariableBenchmark.concat  thrpt    3  55275,436 ± 3778,690  ops/s

After:

Benchmark                          Mode  Cnt      Score     Error  Units
TemplateVariableBenchmark.concat  thrpt    3  64587,790 ± 735,705  ops/s
2022-06-01 17:43:30 +02:00
Michael.Rocke
c2394603fc #1775 - Optimization around constructing UriTemplate when supplying TemplateVariables of same type
Reduce the repeated merge routines on ExpandGroups.

Before:
Benchmark                          Mode  Cnt     Score     Error  Units
TemplateVariableBenchmark.concat  thrpt    3  3150,261 ± 263,525  ops/s

After:
Benchmark                          Mode  Cnt      Score      Error  Units
TemplateVariableBenchmark.concat  thrpt    3  55275,436 ± 3778,690  ops/s
2022-06-01 17:43:30 +02:00
Oliver Drotbohm
2de450531b #1796 - Relax generics bound in ReactiveRepresentationModelAssembler.
We now relax the generic bound of D to … extends RepresentationModel<?> as otherwise implementation code of, for example, toModel(…) has to produce a concrete representation model and cannot be typed to return RepresentationModel<?>.
2022-05-31 12:26:19 +02:00
Oliver Drotbohm
3730a6f270 #1793 - Revamped mapping handling.
Introduced UriMapping to contain the original request mapping used on a controller method as well as a MappingVariables instance that captures all used variables of those mappings. These mappings and variables are not following URI template semantics but rather PathPattern. One example of this playing into the processing is the path segment capture syntax {*…}. This is roughly equivalent to URI template's composite path syntax {/…*}, which however looks different (as the leading slash is contained in the variable expression).

While the handling of those has been added in the commit before, we now introduce the proper abstractions that cause a couple of internal deprecations and binary-incompatible changes and we only want to impose them on implementors upgrading to 2.0. Also, this allows simplifying WebHandler which has accumulated quite a bit of logic already.
2022-05-30 20:21:38 +02:00
Oliver Drotbohm
e29d83d5ea #1793 - Fix handling of {*…} pattern variables in URI mappings.
We now properly handle path segment capture variables in URI mappings. Values handed into the dummy method invocations are expanded properly and a given null results in the composite segment template variable {/…*} being rendered to advertise the ability to add further segments.
2022-05-30 20:21:37 +02:00
Oliver Drotbohm
19c2480f48 #1722 - Fix double encoding of request parameters in LinkBuilderSupport.toUri(…).
We unfortunately cannot use UriComponentsBuilder in a way that we can populate it with encoded parameters *and* expand encoded path variable values. We currently use ….buildAndExpand(…) which considers the values provided unencoded but we never actually call ….toUri() on the resulting UriComponents instance.

We unfortunately cannot fix the problem at its root, as the only alternative would be to call ….build(true) indicating values already encoded but that stumbles above the template variables still present in the original template.

The only workaround right now is never calling UriComponents.toUri() but ….toUriString() as that doesn't apply the pending encoding that's not actually needed as we start with fully encoded values in the first place.
2022-05-16 09:48:54 +02:00
Oliver Drotbohm
57317d0db8 #1722 - Original test case. 2022-05-16 09:42:10 +02:00
Oliver Drotbohm
f4f7f69e1f #1790 - Upgrade to Reactor 2022.0.0 M2. 2022-05-12 20:54:00 +02:00
Oliver Drotbohm
872e514654 #1789 - Update changelog. 2022-05-12 18:01:35 +02:00
Réda Housni Alaoui
4be0e28f30 #1776 - Do not expose URL template variable for MultipartFile parameter. 2022-05-10 15:02:00 +02:00
Oliver Drotbohm
233f50780b #1764 - Performance tweaks in TemplateVariable.toString(…).
Heavily inspired by the PR @MikeRocke, we removed all usage of String.format(…) from hot code paths triggered by ….toString() as it's used in general output a lot.

Before:

Benchmark                                    Mode  Cnt         Score        Error  Units
TemplateVariableBenchmark.toString(…)       thrpt    3   2803239,270 ± 110258,955  ops/s

After:

Benchmark                                    Mode  Cnt         Score        Error  Units
TemplateVariableBenchmark.toString(…)       thrpt    3  10753653,459 ± 156684,459  ops/s
2022-04-14 14:47:14 +02:00
Oliver Drotbohm
ab45ba3f11 #1760 - Prepare changelog for 2.0 M2. 2022-02-17 12:48:14 +01:00
Oliver Drotbohm
a7099a8394 #1750 - Update copyright years to 2022. 2022-02-07 10:35:09 +01:00
Oliver Drotbohm
80c28defba #1757 - Polishing.
Slightly more compact default regex pattern. Untangle defaulting condition in PropertyMetdata.getPattern(). Extract test cases into dedicated methods. Couple of Javadoc fixes. Java-9-based polishing by using Optional.or(…) in JSR 303 PropertyMetadata implementation.
2022-01-28 09:28:40 +01:00
Faron Dutton
1f6f1e24d4 #1757 - Add support for javax.validation.constraints.NotBlank.
The presence of @NonBlank on a representation model's property now causes it to be considered required. It will also cause a default pattern exposed that allows clients to validate input values.

Fixes #1757.
2022-01-28 09:28:40 +01:00
Oliver Drotbohm
c501fa20f7 #1750 - Continue development on 2.0.0-SNAPSHOT. 2022-01-17 08:39:05 +01:00
Oliver Drotbohm
83c072b8cb #1639 - Adapt to HttpMethod now being a class instead of an enum. 2022-01-14 12:05:37 +01:00
Oliver Drotbohm
2431358a83 #1719 - Move off DefaultUriTemplateHandler.
DefaultUriTemplateHandler was deprecated and removed in Spring 6.0. We now use DefaultUriBuilderFactory as recommended in the deprecation part of DUTH's Javadoc.
2022-01-14 12:05:37 +01:00
Oliver Drotbohm
9352e56358 #1639 - Prepare 2.0 development.
Upgrade to Java 17 and Spring Framework 6. Switch to JakartaEE 9 version of the Servlet API. Drop support for Joda Time.

Configure Kotlin plugin to target JDK 1.8 as it doesn't support 17, yet.
2022-01-14 12:05:11 +01:00
Oliver Drotbohm
c5b3857e1c #1749 - Prepare changelog. 2022-01-14 10:03:24 +01:00
Oliver Drotbohm
004c46be3b #1727 - Prevent premature base encoding in UriTemplate if host is templated. 2021-12-10 10:50:05 +01:00
Oliver Drotbohm
809b5ca770 #1729 - Polishing. 2021-12-10 10:37:38 +01:00
Oliver Drotbohm
e65f296f6a #1729 - Added equals(…) and hashCode() methods to TypeBasedPayloadMetadata. 2021-12-10 10:37:36 +01:00
Oliver Drotbohm
313c9d3c9b #1701 - Fix performance degradations introduced by #467.
The commits for #467 significantly degraded performance as CachingMappingDiscoverer.getParams(Method) doesn't properly cache the result of the call which causes quite expensive, unnecessarily repeated annotation lookups for the very same method. We also avoid the creation of an Optional instance for the sole purpose of a simple null check.

Introduce FormatterFactory to potentially cache the to-String formatting functions and thus avoid repeated evaluation and Function object creation.

We now also avoid the creation of ParamRequestCondition instances if no @RequestParams(params = …) values could be found in the first place.
2021-11-23 23:19:08 +01:00
Oliver Drotbohm
4182698eb9 #1701 - Fix potential resource leak in DummyInvocationUtils.
We now constrain the cache of controller proxy instances to 256 elements using Spring's ConcurrentLruCache to avoid instances created via DummyInvocationUtils.methodOn(Class<?>, Object…). The parameters are part of the cache key and used to expand the type-level mappings. If those vary for each call and a request creates a lot of links (>100000) the memory consumption grows significantly, first and foremost indefinitely.

Using the ThreadLocal will still make sure that the cache is local to a current request, so the proxies can actually be reused as the method invocations used to record the mappings would interfere for concurrent requests otherwise.

Removed obsolete generic parameter on the CacheKey type.
2021-11-23 23:18:59 +01:00
Oliver Drotbohm
7b46211790 #1714 - Update change log prior to release. 2021-11-11 15:24:20 +01:00
Oliver Drotbohm
c487fcc802 #1697 - Support for custom property types in HAL FORMS.
As per the discussion in mamund/hal-forms#88, the list of property types in HAL FORMS is not exhaustive. This means we cannot align them with HTML input types and even more so not drop anything not an HTML input type.

This is now implemented by switching to generic Strings in the HAL FORMS property DTO and directly piping the value originally registered on the affordance into it.
2021-11-02 00:15:11 +01:00
Oliver Drotbohm
07125638f4 #1696 - Re-instantiate conversion for request parameter template variables.
When adding a request parameter template variable and the URI part of the template already contains a request parameter we now automatically turn the variable type into request parameter continuation. That apparently got lost in the move to level 4 URI templates in #1583.
2021-10-28 20:42:55 +02:00
Oliver Drotbohm
2cac83fcef #1686 - Avoid serializing empty beans in EntityModel.
The unwrapping nature of EntityModel.getContent() does not work well with value that would result in an empty object being rendered. We now skip the rendering if failing for empty beans is disabled.
2021-10-19 13:54:18 +02:00
Oliver Drotbohm
e0f1643448 #1688 - Use Links.collector() in JsonPathLinkDiscoverer. 2021-10-19 13:24:38 +02:00
Oliver Drotbohm
b78d6d59b9 #1687 - Fix Javadoc in LinkDiscovererfindLinkWithRel(…). 2021-10-19 13:23:16 +02:00