Commit Graph

5329 Commits

Author SHA1 Message Date
Brian Clozel
2cdc406e71 Merge branch '6.2.x' 2025-01-07 09:04:05 +01:00
Mattias-Sehlstedt
50b1fb0b15 Change the description for the uri client request observation
This commit describes what parts that are removed from the URI template
keyvalue.

Closes: gh-34116
Signed-off-by: Mattias-Sehlstedt <60173714+Mattias-Sehlstedt@users.noreply.github.com>
2025-01-07 09:02:25 +01:00
Brian Clozel
e8e722fb59 Allow multiple executions of ClientHttpRequestInterceptors
Prior to this commit, an `ClientHttpRequestInterceptor` implementation
could delegate HTTP calls to the next `ClientHttpRequestExecution` only
once. Calling the execution would advance to the next interceptor in the
chain in a mutable fashion for the entire lifetime of the current
exchange.

This commit changes the implementation of `InterceptingClientHttpRequest`
so that a `ClientHttpRequestInterceptor` implementation can call
`ClientHttpRequestExecution#execute` multiple times.

This is especially useful for interceptors in case they want to issue
other HTTP requests without needing another `RestTemplate` or
`RestClient` instance provided out of band.

Closes gh-34169
2025-01-06 19:29:09 +01:00
rstoyanchev
e2ea87fe4f Merge branch '6.2.x' 2025-01-06 12:13:56 +00:00
rstoyanchev
6ec7dcf2c1 Synchronize in WebAsyncManager onError/onTimeout
On connection loss, in a race between application thread and onError
callback trying to set the DeferredResult and dispatch, the onError
callback must not exit until dispatch completes. Currently, it may do
so because the DeferredResult has checks to bypasses locking or even
trying to dispatch if result is already set.

Closes gh-34192
2025-01-06 12:06:43 +00:00
rstoyanchev
d94e04d97a Minor refactoring in WebAsyncManager
There is no need to set the DeferredResult from WebAsyncManager in an
onError notification because it is already done from the Lifecycle
interceptor in DeferredResult.

See gh-34192
2025-01-06 12:06:43 +00:00
rstoyanchev
5a44897c55 Polishing in WebAsyncManager
See gh-34192
2025-01-06 12:06:43 +00:00
Sam Brannen
8bba4f641f Update copyright headers to 2025 2025-01-05 17:02:14 +02:00
Sam Brannen
99bcd3a845 Remove unused code 2025-01-03 17:43:17 +02:00
Sam Brannen
e26c161ae9 Clean up warnings 2025-01-03 17:42:57 +02:00
Brian Clozel
b6de2b0611 Merge branch '6.2.x' 2025-01-02 20:12:14 +01:00
Brian Clozel
d927d64c40 Improve query params in uri KeyValue with HTTP interface client
Prior to this commit, the HTTP interface client would create URI
templates and name query params like so:
"?{queryParam0}={queryParam0[0]}".
While technically correct, the URI template is further used in
observations as a KeyValue. This means that several service methods
could result in having the exact same URI template even if they produce
a different set of query params.

This commit improves the naming of query params in the generated URI
templates for better observability integration.

Closes gh-34176
2025-01-02 20:00:38 +01:00
Sébastien Deleuze
08d7a38546 Merge branch '6.2.x' 2024-12-30 09:06:24 +01:00
Johnny Lim
6d86b23fbe Apply Checkstyle MethodParamPadCheck module
This commit also fixes its violations.

Closes gh-34173
2024-12-30 09:02:06 +01:00
Simon Baslé
a2bc1ded73 Polishing, fix checkstyle errors 2024-12-27 14:00:38 +01:00
Simon Baslé
eb9ee9fafa Polishing
`@since` missing tags in some methods related to the HttpHeaders change
2024-12-27 12:14:23 +01:00
Simon Baslé
f025d60b92 Merge branch '6.2.x' 2024-12-27 11:00:10 +01:00
Simon Baslé
0f38c28e91 Fix ServletRequestDataBinder ctor binding with []-indexed query params
This change ensures that a request containing query parameters in the
array format `someArray[]=value` can be bound into a simple array in
constructors, even for cases where the array values don't have nested
properties.

The value resolver is directly called in the constructor case, before
any mutable properties are considered or even cleared (see
`WebDataBinder#adaptEmptyArrayIndices` method). As a result, we need to
accommodate the possibility that the request stores array elements under
the `name[]` key rather than `name`. This change attempts a secondary
lookup with the `[]` suffix if the type is a list or array, and the key
doesn't include an index.

Closes gh-34121
2024-12-27 10:59:15 +01:00
Sébastien Deleuze
5fba926ab6 Refine null-safety in the spring-web module
Closes gh-34162
2024-12-26 18:50:17 +01:00
Sébastien Deleuze
a442c180f1 Refine null-safety in the spring-test module
Closes gh-34161
2024-12-26 17:49:17 +01:00
Simon Baslé
f24f9a4ba4 Polishing
Javadoc links to `HttpHeaders#remove` now use the new String-based
signature.

See gh-33913
2024-12-26 10:30:46 +01:00
Simon Baslé
0c6f5d7d29 HttpHeaders are no longer a MultiValueMap
This change removes the `MultiValueMap` nature of `HttpHeaders`, since
it inherits APIs that do not align well with underlying server
implementations. Notably, methods that allows to iterate over the whole
collection of headers are susceptible to artificially introduced
duplicates when multiple casings are used for a given header, depending
on the underlying implementation.

This change includes a dedicated key set implementation to support
iterator-based removal, and either keeps map method implementations that
are relevant or introduces header-focused methods that have a similar
responsibility (like `hasHeaderValues(String, List)` and
`containsHeaderValue(String, String)`).

In order to nudge users away from using an HttpHeaders as a Map, the
`asSingleValueMap` view is deprecated. In order to offer an escape
hatch to users that do make use of the `MultiValueMap` API, a similar
`asMultiValueMap` view is introduced but is immediately marked as
deprecated.

This change also adds map-like but header-focused assertions to
`HttpHeadersAssert`, since it cannot extend `AbstractMapAssert` anymore.

Closes gh-33913
2024-12-24 14:43:51 +01:00
Sébastien Deleuze
528578d138 Merge branch '6.2.x' 2024-12-23 15:34:57 +01:00
Sébastien Deleuze
69b74d7645 Fix NullPointerException in HttpComponentsClientHttpResponse
Closes gh-34132
2024-12-23 15:34:04 +01:00
rstoyanchev
373763723e Deprecate use of PathMatcher and UrlPathHelper in web
Closes gh-34018
2024-12-19 15:59:41 +00:00
Sébastien Deleuze
0e85d950b3 Remove unneeded @NonNull annotations
See gh-28797
2024-12-19 11:07:33 +01:00
Sébastien Deleuze
bc5d771a06 Switch to JSpecify annotations
This commit updates the whole Spring Framework codebase to use JSpecify
annotations instead of Spring null-safety annotations with JSR 305
semantics.

JSpecify provides signficant enhancements such as properly defined
specifications, a canonical dependency with no split-package issue,
better tooling, better Kotlin integration and the capability to specify
generic type, array and varargs element null-safety. Generic type
null-safety is not defined by this commit yet and will be specified
later.

A key difference is that Spring null-safety annotations, following
JSR 305 semantics, apply to fields, parameters and return values,
while JSpecify annotations apply to type usages. That's why this
commit moves nullability annotations closer to the type for fields
and return values.

See gh-28797
2024-12-19 11:07:23 +01:00
rstoyanchev
2e6046a655 Remove trailing slash matching in PathPatternParser
See gh-34036
2024-12-17 11:14:00 +00:00
rstoyanchev
7f4da52cc5 Remove Spring MVC path extension content negotiation
See gh-34036
2024-12-17 09:49:07 +00:00
Sam Brannen
aa7793a593 Removed unused code from ContentDisposition
See gh-33809
2024-12-15 15:54:23 +01:00
Sam Brannen
8a8df90a46 Restore TomcatHeadersAdapter.clear() behavior
This commit restores the original behavior of the clear() method in
TomcatHeadersAdapter by delegating to
org.apache.tomcat.util.http.MimeHeaders.recycle(), which aligns with
the memory efficiency goals documented in the class-level Javadoc for
MimeHeaders.

See gh-33916
Closes gh-34092
2024-12-15 15:34:49 +01:00
Johnny Lim
c8009dc67d Fix TomcatHeadersAdapter.clear()
This commit fixes a regression introduced in TomcatHeadersAdapter in
conjunction with gh-33916.

Closes gh-34092
2024-12-15 15:24:37 +01:00
Juergen Hoeller
0aa721cad0 Polishing 2024-12-11 17:52:59 +01:00
rstoyanchev
640e570583 Minor refactoring in ServerSentEvent
Extract re-usable method to serialize SSE fields.

See gh-33975
2024-12-11 16:09:22 +00:00
rstoyanchev
66f33a8265 MapMethodProcessor supportsParameter is more specific
Closes gh-33160
2024-12-11 16:09:01 +00:00
Juergen Hoeller
9fe69e2cc4 Merge branch '6.2.x' 2024-12-11 16:59:31 +01:00
Juergen Hoeller
68997d8416 Avoid javadoc references to deprecated types/methods 2024-12-11 16:58:37 +01:00
rstoyanchev
c4b100ac0c Minor refactoring in ServerSentEvent
Extract re-usable method to serialize SSE fields.

See gh-33975
2024-12-11 12:22:56 +00:00
rstoyanchev
fd8823819f MapMethodProcessor supportsParameter is more specific
Closes gh-33160
2024-12-11 12:22:56 +00:00
Stéphane Nicoll
2546f63824 Merge branch '6.2.x' 2024-12-10 07:48:01 +01:00
youable
5494d78018 Polish
See gh-33891
2024-12-10 07:47:42 +01:00
Brian Clozel
810da11bb5 Remove deprecated web APIs
This commit also marks for removal APIs that were deprecated a long time
ago but were not marked for removal.

See gh-33809
2024-12-08 22:50:54 +01:00
Brian Clozel
5044b70a40 Remove deprecated MediaType entries
See gh-33809
2024-12-08 21:01:11 +01:00
Brian Clozel
ff28d2d47a Polishing MediaType Javadoc
Closes gh-34047
2024-12-08 20:44:57 +01:00
Juergen Hoeller
edf7f3cd43 Polishing 2024-12-04 16:41:07 +01:00
Juergen Hoeller
2b9010c2a2 Remove APIs marked as deprecated for removal
Closes gh-33809
2024-12-04 13:19:39 +01:00
Brian Clozel
342369355d Polishing 2024-12-03 15:59:12 +01:00
Sam Brannen
d41d674c4f Update code due to upgrade to Jakarta EE 11 APIs 2024-12-03 15:10:32 +01:00
Juergen Hoeller
949432ce8b General upgrade to Jakarta EE 11 APIs
Includes removal of ManagedBean and javax.annotation legacy support.
Includes AbstractJson(Http)MessageConverter revision for Yasson 3.0.
Includes initial Hibernate ORM 7.0 upgrade.

Closes gh-34011
Closes gh-33750
2024-12-03 13:30:25 +01:00
rstoyanchev
15c6d3449b Merge branch '6.2.x' 2024-12-02 17:52:56 +00:00