Commit Graph

2039 Commits

Author SHA1 Message Date
Brian Clozel 89ce63f1f3 Replace RFC7807 by RFC9457 in documentation
This commit updates all references to RFC7807 by RFC9457 since the
former is now obsolete.

Closes gh-32806
2024-05-13 10:42:35 +02:00
Juergen Hoeller 4f02be263f Polishing 2024-05-07 15:52:13 +02:00
Juergen Hoeller 580adfcbed Polishing 2024-04-23 16:07:09 +02:00
Juergen Hoeller 39cd31613b Polishing 2024-04-10 18:06:32 +02:00
rstoyanchev 8d05028c2e RequestParam resolver supports empty array suffix
Closes gh-32577
2024-04-09 18:24:57 +01:00
Stéphane Nicoll b68f76c86e Polish
See gh-32502
2024-04-04 14:42:41 +02:00
Simon Baslé 521cda009b Use non-blocking thread in WebFlux controller with RequestBody parameter
This commit ensures that `InvocableHandlerMethod` executes the method
on the desired thread if a non-blocking thread is specified, even in the
case where arguments resolution happens on a different thread. This is
notably the case if the method body is resolved as an input argument to
the controller method (`@RequestBody`).

Closes gh-32502
2024-04-04 14:20:16 +02:00
Sébastien Deleuze 048e4f0aa2 Invoke KCallablesJvm.setAccessible only when required
Closes-32536
2024-03-28 11:12:50 +01:00
T45K b28153e1d7 Fix handling of value class with private constructor
See gh-32536
2024-03-28 11:11:58 +01:00
Sébastien Deleuze 290a41d398 Refine null-safety in more modules
This commit refines the null-safety in all remaining modules
except spring-test.

See gh-32475
2024-03-26 15:39:18 +01:00
Sébastien Deleuze a63ebe7e9d Refine null-safety in spring-web and spring-websocket
See gh-32475
2024-03-25 11:02:44 +01:00
Sébastien Deleuze 87dfa492af Refine null-safety in spring-webflux
See gh-32475
2024-03-22 16:05:17 +01:00
Sébastien Deleuze cf9033a60d Polishing 2024-03-22 16:04:03 +01:00
Sébastien Deleuze 1e80694daf Fix a regression with Kotlin generic controllers
This commit reintroduces a more defensive parameter type check that
skips KClass casting for generic parameters.

Closes gh-32510
2024-03-21 17:55:57 +01:00
Juergen Hoeller c531a8a705 Nullability refinements and related polishing
See gh-32475
2024-03-19 09:58:44 +01:00
Brian Clozel 9910df85cd Remove observation context from ClientRequest
Prior to this commit, gh-31609 added the current observation context as
a request attribute for `WebClient` calls. While it was not confirmed as
the main cause, this feature was linked to several reports of memory
leaks. This would indeed attach more memory to the request object graph
at runtime - although it shouldn't prevent its collection by the GC.

This commit removes this feature and instead developers should get the
current observation from the reactor context if they wish to interact
with it.

Closes gh-32198
2024-03-12 09:49:00 +01:00
Sébastien Deleuze 80f3be6577 Replace getJvmErasure by getClassifier
Should be slightly faster.

See gh-32334
2024-03-11 13:37:41 +01:00
Brian Clozel f6bc828569 Set error on observation in WebClient instrumentation
Prior to this commit, error signals flowing from the client response
publisher in `WebClient` would be set on the `Observation.Context`. This
is enough for the observation convention to collect data about the error
but observation handlers are not notified of this error.

This commit sets the error instead on the observation directly to fix
this issue.

Fixes gh-32389
2024-03-08 11:33:45 +01:00
Sébastien Deleuze c1d4b610ca Refine Kotlin inline class optimizations
Closes gh-32334
2024-03-07 11:11:20 +01:00
rstoyanchev 5f601ceb45 Mark response errors from @ExceptionHandler as handled
Also fix a couple of related issues:
- add AsyncRequestNotUsableException to the list of exceptions
that imply response issues.
- handle exceptions from @ExceptionHandler regardless of whether
thrown immediately or via Publisher.

Closes gh-32359
2024-03-06 18:17:13 +00:00
Sébastien Deleuze 516a203703 Support nullable Kotlin value class arguments
This commit skips the value class parameter instantiation for nullable
types when a null argument is passed.

Closes gh-32353
2024-03-03 22:26:21 +01:00
Sébastien Deleuze 227e75dae4 Support nullable Kotlin value class arguments
This commit refines WebMVC and WebFlux argument resolution in order to
convert properly Kotlin value class arguments by using the type of the
value instead of the type of the value class.

Closes gh-32353
2024-03-01 16:38:26 +01:00
Sébastien Deleuze 85a781d517 Instantiate value class parameters with Kotlin reflection
In order to invoke the init block and to improve the maintainability.

Closes gh-32324
2024-03-01 11:50:19 +01:00
Sébastien Deleuze 45c21042f6 Optimize Kotlin inline class checks
This commit fixes a performance regression caused by gh-31698,
and more specifically by KClass#isValue invocations which are slow since
they load the whole module to find the class to get the descriptor.

After discussing with the Kotlin team, it has been decided that only
checking for the presence of `@JvmInline` annotation is enough for
Spring use case.

As a consequence, this commit introduces a new
KotlinDetector#isInlineClass method that performs such check, and
BeanUtils, CoroutinesUtils and WebMVC/WebFlux InvocableHandlerMethod
have been refined to leverage it.

Closes gh-32334
2024-02-28 17:18:57 +01:00
Sébastien Deleuze abe381488a Add missing RequestPredicate variants in coRouter
Closes gh-32256
2024-02-13 14:50:49 +01:00
Sébastien Deleuze 2fe3321813 Fix pathExtension null-safety in Kotlin DSLs
Closes gh-32254
2024-02-13 14:24:19 +01:00
Sébastien Deleuze 2d7b2e59b6 Add resource redirection to WebFlux functional router
See gh-27257
2024-02-13 13:24:13 +01:00
Arjen Poutsma 750cb73902 Introduce single-value request predicates
This commit introduces new HTTP method, Content-Type, and Accept header
request predicates that handle single values. Previously, these
predicates were always dealt with as single-value collections, which
introduced computational overhead.

Closes gh-32244
2024-02-12 16:09:00 +01:00
Sébastien Deleuze 99bdc4211d Add Coroutines support to NonReactiveHandlerMethodPredicate
Closes gh-32227
2024-02-09 12:07:17 +01:00
Arjen Poutsma af44b3e6c0 Fix delegation in ServerRequest decorators
Closes gh-31955
2024-02-08 11:33:22 +01:00
Patrick Strawderman d5cb1d9adb Initialize Map with correct size in RequestPredicates
Prior to this commit, the `RequestPredicates` would add new attributes
to the existing request attributes by creating a new `LinkedHashMap`
with the total number of elements as its new initial capacity.

This would not achieve optimal performance as initial resize or rehash
operations could be expected. Consistently using
`CollectionUtils#newLinkedHashMap` avoids this problem.

Closes gh-32201
2024-02-06 10:54:00 +01:00
Sam Brannen 067638ae6e Introduce ClassUtils.isVoidType() utility method 2024-01-30 16:27:34 +01:00
Sam Brannen 398cc01650 Polishing 2024-01-30 16:24:55 +01:00
Sam Brannen db535863dd Consistently use class literals for primitive types
To improve consistency and avoid confusion regarding primitive types
and their wrapper types, this commit ensures that we always use class
literals for primitive types.

For example, instead of using the `Void.TYPE` constant, we now
consistently use `void.class`.
2024-01-30 15:26:12 +01:00
Sam Brannen 9eae0ba50e Clean up warnings in build 2024-01-29 17:47:46 +01:00
Kai Zander d96a63944c Simplify use of Reactor's cast operator
This commit replaces filter(x -> x instanceof C).cast(C.class) with the
built-in ofType(C.class).

See gh-32141
2024-01-27 12:21:46 +01:00
Arjen Poutsma f2e267b494 Guard against multiple body subscriptions
Before this commit, the JDK and Jetty connectors do not have any
safeguards against multiple body subscriptions. Such as check has now
been added.

Closes gh-32100
2024-01-24 14:05:20 +01:00
Juergen Hoeller 199a675692 Declare current observation context as available since 6.0.15
See gh-31609
See gh-31646
2024-01-24 12:40:00 +01:00
Juergen Hoeller 2f921dd13d Declare allowPrivateNetwork as available since 5.3.32
See gh-28546
See gh-31974
2024-01-24 12:37:19 +01:00
Sam Brannen 45a1f98bd6 Polishing 2024-01-23 11:36:24 +01:00
Juergen Hoeller 5faace0eb3 Predetermine validation groups on initialization
Closes gh-32068
2024-01-23 11:15:12 +01:00
Sam Brannen 3b2f6e74a6 Make assertions based on Annotation#toString() lenient
The behavior for the toString() implementation for annotations changed
in JDK 19, per my request to the JDK team (see link below).

Specifically, since JDK 19, the toString() implementation for annotation
proxies created by the JDK started using canonical names instead of
binary names for types.

See https://bugs.openjdk.org/browse/JDK-8281462
2024-01-23 10:41:40 +01:00
Sam Brannen 1a52c56bd4 Polishing 2024-01-19 19:16:41 +01:00
Sam Brannen 4cc91a2869 Ensure inherited @⁠HttpExchange annotation can be overridden in controller
This commit revises the RequestMappingHandlerMapping implementations in
Spring MVC and Spring WebFlux to ensure that a @⁠Controller class which
implements an interface annotated with @⁠HttpExchange annotations can
inherit the @⁠HttpExchange declarations from the interface or
optionally override them locally with @⁠HttpExchange or
@⁠RequestMapping annotations.

Closes gh-32065
2024-01-19 18:54:31 +01:00
Sam Brannen 6697461003 Reject mixed @⁠RequestMapping and @⁠HttpExchange declarations in MVC & WebFlux
This commit updates the RequestMappingHandlerMapping implementations in
Spring MVC and Spring WebFlux so that mixed @⁠RequestMapping and
@⁠HttpExchange declarations on the same element are rejected.

Note, however, that a @⁠Controller class which implements an interface
annotated with @⁠HttpExchange annotations can still inherit the
@⁠HttpExchange declarations from the interface or optionally override
them locally with @⁠HttpExchange or @⁠RequestMapping annotations.

See gh-31962
See gh-32049
Closes gh-32065
2024-01-19 16:23:42 +01:00
Sam Brannen 2ec0c16889 Polishing 2024-01-18 17:30:07 +01:00
Sam Brannen d1d9d483fe Document @⁠HttpExchange support in RequestMappingHandlerMapping 2024-01-18 16:28:40 +01:00
Sam Brannen b8b31ff8a1 Reject multiple @⁠HttpExchange declarations in MVC and WebFlux
This commit updates the RequestMappingHandlerMapping implementations in
Spring MVC and Spring WebFlux so that multiple @⁠HttpExchange
declarations on the same element are rejected.

Closes gh-32049
2024-01-18 15:29:30 +01:00
Sam Brannen c5c77b93fe Polishing 2024-01-18 15:29:30 +01:00
Sam Brannen 6b905049eb Polishing
See gh-31962
2024-01-18 14:21:45 +01:00