Commit Graph

2519 Commits

Author SHA1 Message Date
Sébastien Deleuze
b8d9dee7be Refine Kotlin serialization converters/codecs conditions
This commit is a follow-up of 34410 to refine the activation conditions
of Kotlin serialization converters/codecs.

Closes gh-34438
2025-02-17 18:40:05 +01:00
Sébastien Deleuze
6bdb9bb950 Support open polymorphism with Kotlin Serialization
This commit introduces open polymorphism support with Kotlin
Serialization in HTTP converters and codecs as a follow-up of gh-34410
which considers Kotlin Serialization as a Jackson/Gson/Jsonb equivalent
(it is not anymore configured before Jackson).

Closes gh-34433
2025-02-17 18:40:05 +01:00
rstoyanchev
011e398355 UriComponents formats Collection query param URI var
Closes gh-34311
2025-02-12 11:48:27 +00:00
Mengqi Xu
295a9565a3 Format Collection query param in UriComponentsBuilder
See gh-34311

Signed-off-by: Mengqi Xu <2663479778@qq.com>
2025-02-12 11:48:27 +00:00
Brian Clozel
7077809561 Configure Kotlin JSON converters as Jackson alternative
Prior to this commit, Spring MVC and WebFlux would consider the
"kotlinx.serialization" JSON codecs and converters in addition to other
JSON alternatives like Jackson, Gson and Jsonb.

This would cause issues because while in most cases this library is only
involved if the type is annotated with "@Serializable", this is not true
for Java enums. In this particular case, the codec shadows Jackson and
causes issues.

This commit now considers kotlinx.serialization JSON support as an
alternative to Jackson. Just like Jsonb and GSON, this is only
auto-detected if Jackson is not present.
We received consistent feedback that kotlinx.serialization is popular in
Kotlin libraries and is often a transitive dependency. As a result, we
cannot consider its presence on the classpath as a strong enough signal
to configure it by default.

Closes gh-34410
2025-02-11 20:05:53 +01:00
Sam Brannen
6ded25ba28 Merge branch '6.2.x' 2025-02-11 16:31:12 +01:00
Sam Brannen
124b38450b Remove unused code and improve assertion
See gh-34363
2025-02-11 16:30:52 +01:00
rstoyanchev
e9d16da633 Remove Netty 5 support
Closes gh-34345
2025-02-11 12:27:33 +00:00
rstoyanchev
bae12e739d Merge branch '6.2.x' 2025-02-11 11:18:23 +00:00
rstoyanchev
d04883f839 HTTP Interface client handles query param with ":"
Closes gh-34364
2025-02-11 11:11:05 +00:00
rstoyanchev
b0a1a11612 Merge branch '6.2.x' 2025-02-10 11:15:08 +00:00
rstoyanchev
7a0fe7d14f WebAsyncManager wraps disconnected client errors
If the Servlet container delegates a disconnected client error via
AsyncListener#onError, wrap it as AsyncRequestNotUsableException
for more targeted and consistent handling of such errors.

Closes gh-34363
2025-02-10 11:14:21 +00:00
Brian Clozel
6d63abd4e9 Merge branch '6.2.x' 2025-02-10 09:24:44 +01:00
Andras Dobrosi
2b4c7d09b0 Match ContentDisposition attributes case-insensitively
This commit ensures that `ContentDisposition` parses attributes like
"filename" and "filename*" in a case insensitive fashion, per RFC 6266.

Closes gh-34383

Signed-off-by: Andras Dobrosi <dobrosi@gmail.com>
[brian.clozel@broadcom.com: apply code conventions]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
2025-02-10 09:21:02 +01:00
rstoyanchev
55a090602b Merge branch '6.2.x' 2025-02-07 13:23:14 +00:00
rstoyanchev
56c4d2d4ca Improve HandlerMethod#resolvedFromHandlerMethod initialization
Ensure the original instance is always the one returned no matter how
many times the HandlerMethod is re-created.

Make the constructor protected to allow subclasses to re-create the
HandlerMethod as the concrete subclass.

See gh-34375
2025-02-07 13:10:55 +00:00
Bryce J. Fisher
2a846c9594 Add HttpHeaders.copyOf factory method
Prior to this commit, the `HttpHeaders` class would provide constructor
variants where the instances are are backed by the existing headers
collection given as a parameter.

While such constructors are clearly documented and meant for internal
usage, there are cases where developers would like to copy the data from
an existing headers instance without being backed by the same collection
instance and thus, being mutated from some place else.

This commit introduces new factory methods `HttpHeaders.copyOf` for this
purpose. While this name aligns with some of the Java collections
factory methods, in this case the returned instance is not immutable, on
purpose. `HttpHeaders` does not extends `MultiValueMap` anymore and
shouldn't be seen as such.

Closes: gh-34341

Signed-off-by: Bryce J. Fisher <bryce.fisher@gmail.com>
[brian.clozel@broadcom.com: reduce scope and update javadoc]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
2025-02-06 14:24:41 +01:00
rstoyanchev
03984bacf4 Merge branch '6.2.x' 2025-02-05 14:34:11 +00:00
rstoyanchev
3898482d3f Revert commit 0f38c28e91
The fix is not how the issue needs to be addressed.

See gh-34121
2025-02-05 14:26:12 +00:00
rstoyanchev
f5b5f9a639 Fix forwarded host formatting
Follow-up to recent commit
75e2e2c3c7

Closes gh-34253
2025-01-28 15:53:14 +00:00
rstoyanchev
52c187bf64 Merge branch '6.2.x' 2025-01-28 15:37:38 +00:00
rstoyanchev
9b58df8857 Update HandlerMethod#createWithResolvedBean
Avoid re-creating the instance unless it is a bean name that
needs to be resolved through the BeanFactory.

Closes gh-34277
2025-01-28 15:36:26 +00:00
Sébastien Deleuze
db3c2b39b1 Remove HttpHeaders#asMultiValueMap usages from Kotlin tests
Closes gh-34327
2025-01-27 15:57:54 +01:00
Sam Brannen
5574f45cb1 Merge branch '6.2.x' 2025-01-27 15:22:10 +01:00
Sam Brannen
34d6dd9b62 Polishing 2025-01-27 15:19:00 +01:00
Sébastien Deleuze
1167b30b3f Merge branch '6.2.x' 2025-01-27 15:07:59 +01:00
Sébastien Deleuze
5499878de0 Support properties in kotlinx.serialization converters
This commit adds support for Kotlin properties in Spring WebMVC
controllers, supported for reasons explained in gh-31856, with
kotlinx.serialization converters.

Closes gh-34284
2025-01-27 15:06:57 +01:00
Sébastien Deleuze
a970fc16aa Support properties in kotlinx.serialization codecs
This commit adds support for Kotlin properties in Spring WebFlux
controllers, supported for reasons explained in gh-31856, with
kotlinx.serialization codecs.

See gh-34284
2025-01-27 15:06:50 +01:00
Brian Clozel
f85752a956 Fix hints and predicates for Field reflective access
This commit revisits the arrangement for Field hints after changes made
in gh-34239.

Closes gh-34294
2025-01-21 20:05:12 +01:00
rstoyanchev
92472a6b62 Merge branch '6.2.x' 2025-01-21 12:23:05 +00:00
rstoyanchev
b026680e1c Enhance DisconnectedClientHelper exception type checks
We now look for the target exception types in cause chain as well,
but return false if we encounter a RestClient or WebClient
exception in the chain.

Closes gh-34264
2025-01-21 12:21:22 +00:00
rstoyanchev
e47cc19964 Restore exception phrase in DisconnectedClientHelper
Effectively revert 203fa7, and add implementation comment and tests.

See gh-34264
2025-01-21 12:21:22 +00:00
rstoyanchev
eb15b26abe Add since and forRemoval to @Deprecated 2025-01-16 15:47:52 +00:00
rstoyanchev
6873427aa7 Merge branch '6.2.x' 2025-01-15 19:04:57 +00:00
rstoyanchev
384d2749c6 Polishing in HttpServiceMethod 2025-01-15 19:03:00 +00:00
rstoyanchev
5150a9a6ad Polishing contribution
Closes gh-34230
2025-01-15 18:31:50 +00:00
Yanming Zhou
a8c5885aff Fix wrong document about RequestHeaderArgumentResolver
Also test is added to verify that.

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>

See gh-34230
2025-01-15 18:31:49 +00:00
rstoyanchev
3b1d14a64d Fix checkstyle warning
See gh-34253
2025-01-15 18:13:42 +00:00
rstoyanchev
75e2e2c3c7 Consistent formatting of forward for host
Closes gh-34253
2025-01-15 17:53:30 +00:00
rstoyanchev
4920086225 Remove deprecated web APIs
See gh-33809
2025-01-15 16:26:16 +00:00
rstoyanchev
83c020eea5 Remove deprecated HttpStatus codes
See gh-33809
2025-01-15 16:26:16 +00:00
rstoyanchev
9ddbf800b9 Remove deprecated APIs in spring-web
See gh-33809
2025-01-15 16:26:16 +00:00
Brian Clozel
d28c0396c9 Update runtime hints predicates after GraalVM changes
As of gh-33847, method and field introspection is included by default
when a type is registered for reflection.
Many methods in ReflectionHintsPredicates are now mostly useless as their
default behavior checks for introspection.

This commit deprecates those methods and promotes instead invocation
variants. During the upgrade, developers should replace it for an
`onType` check if only reflection is required. If they were checking for
invocation, they should use the new 'onXInvocation` method.

Closes gh-34239
2025-01-13 15:34:34 +01:00
Brian Clozel
f2a18e5920 Upgrade to Jetty 12.1.0.alpha0
Closes gh-34237
2025-01-10 18:03:10 +01:00
rstoyanchev
39bb751546 Polishing 2025-01-10 14:39:24 +00:00
rstoyanchev
be5542a7a7 Add buffering predicate to RestTemplate
See gh-33785
2025-01-10 14:39:24 +00:00
rstoyanchev
a72855b2b3 DefaultResponseErrorHandler updates
Deprecate handleError(response), and ensure it continues to be invoked
if overridden.

See gh-34231
2025-01-10 10:51:11 +01:00
rstoyanchev
cdddf09c20 Polishing in DefaultResponseErrorHandler
See gh-34231
2025-01-10 10:50:41 +01:00
rstoyanchev
27c4f0e29d Built-in buffering support in RestClient
Closes gh-33785
2025-01-08 13:46:15 +00:00
rstoyanchev
b9efa91ecc Polishing in client tests 2025-01-08 13:46:15 +00:00