Commit Graph

5361 Commits

Author SHA1 Message Date
Juergen Hoeller 8ab965c981 Merge branch '6.1.x'
# Conflicts:
#	spring-web/src/main/java/org/springframework/web/method/annotation/AbstractNamedValueMethodArgumentResolver.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java
2024-09-30 11:17:55 +02:00
Juergen Hoeller 87157d3200 Polishing 2024-09-30 11:13:50 +02:00
Juergen Hoeller 95f181352f Defensively check MethodParameter.getMethod() in KotlinDelegate
Closes gh-33609
2024-09-30 11:13:26 +02:00
Juergen Hoeller 5326640f79 Initialize application context with initializer-given ServletContext
Closes gh-22319
2024-09-26 18:31:02 +02:00
Yanming Zhou 8941e2876e Replace 'e.g.' with 'for example' in documentation and comments
Closes gh-33515
2024-09-26 14:11:17 +02:00
rstoyanchev dea4f71846 Update contribution
Closes gh-33090
2024-09-25 16:09:01 +01:00
cfredri4 883f123583 Use only one timeout in JdkClientHttpRequest
Previously, a timeout was set both on HttpRequest, and used on
httpClient.sendAsync().get(). This leads to inconsistent behaviour
depending on which timeout gets triggered first.

See gh-33090
2024-09-25 16:09:01 +01:00
rstoyanchev 7051cddcf7 Align OutputStreamPublisher's
Align internal handling and contracts. The core copy could do without
those contracts, but it helps with alignment, and it's internal to
the implementation.

Closes gh-33592
2024-09-25 11:42:26 +01:00
rstoyanchev f6c31bb6c3 Align OutputStreamPublisher's
Update constructors to match and drop unnecessary factory methods.

See gh-33592
2024-09-25 11:42:26 +01:00
rstoyanchev 113b430fab Align OutputStreamPublisher's
Apply recent nullability changes, and formatting differences.

See gh-33592
2024-09-25 11:42:26 +01:00
Sébastien Deleuze 81a66a0334 Add an AbstractGenericHttpMessageConverter constructor
This commit adds a new
AbstractGenericHttpMessageConverter(Charset, MediaType...)
constructor, similar to the one present in
AbstractHttpMessageConverter.

Closes gh-33563
2024-09-24 19:40:15 +02:00
Sam Brannen f6fcf15745 Merge branch '6.1.x' 2024-09-24 12:33:58 +02:00
Sam Brannen af3a26ab06 Clean up warnings in Gradle build 2024-09-24 12:33:35 +02:00
Sam Brannen 66a518abd5 Merge branch '6.1.x' 2024-09-24 12:23:47 +02:00
Sam Brannen 88905ea20d Upgrade to Apache HttpClient 5.4
This commit also updates the external Javadoc link to avoid the following
warning in the build.

URL https://hc.apache.org/httpcomponents-client-5.2.x/current/httpclient5/apidocs/package-list was redirected to https://hc.apache.org/httpcomponents-client-5.4.x/current/httpclient5/apidocs/package-list

Closes gh-33587
2024-09-24 12:20:44 +02:00
Tran Ngoc Nhan c85050eb43 Consistently use CharSequence.isEmpty() for emptiness checks
Closes gh-33577
2024-09-23 17:10:21 +02:00
Sam Brannen 8931b75b95 Polishing 2024-09-20 10:58:37 +02:00
Johnny Lim 3ba9d35e22 Polish
Closes gh-33566
2024-09-20 10:58:37 +02:00
rstoyanchev 4706ebc81e Minor refactoring in UrlHandlerFilter
See gh-33565
2024-09-19 11:55:53 +01:00
rstoyanchev 2090ece62a UrlHandlerFilter ignores trailing slash in contextPath
Closes gh-33565
2024-09-19 11:55:25 +01:00
Simon Baslé c832d5f496 Polishing contribution
Fixes gh-33556
2024-09-18 11:44:29 +02:00
Carl Magnuson 453e7961a8 Add read timeout setter on HttpComponentsClientHttpRequestFactory
This commit adds support for HttpComponentsClientHttpRequestFactory to
set a read timeout, used on the underlying client as a RequestTimeout.

This brings the HttpComponentsClientHttpRequestFactory into alignment
with JDK, Jetty, OkHttp3, Reactor and SimpleClient
ClientHttpRequestFactory implementations.

See gh-33556
2024-09-18 11:44:29 +02:00
Sébastien Deleuze d3755aba06 Add RestClient.Builder#messageConverters(List)
This commit also introduces the validation of the RestClient
message converters for both variants.

Closes gh-33536
2024-09-13 16:00:38 +02:00
Brian Clozel 0a001482c3 Merge branch '6.1.x' 2024-09-13 15:53:18 +02:00
Brian Clozel 5efb385e64 Read Expires cookie attribute in HttpComponents connector
Prior to this commit, the HttpComponents implementation for the
`WebClient` would only consider the max-age attribute of response
cookies when parsing the response. This is not aligned with other client
implementations that consider the max-age attribute first, and then the
expires if the former was not present. The expires date is then
translated into a max-age duration. This behavior is done naturally by
several implementations.

This commit updates the `HttpComponentsClientHttpResponse` to do the
same.

Fixes gh-33157
2024-09-13 15:49:06 +02:00
Juergen Hoeller 042346aa6a Harmonize Reactor client class names within the http.client package
Closes gh-33382
2024-09-11 16:27:56 +02:00
rstoyanchev 1ff2678147 Add UrlHandlerFilter for WebFlux
Closes gh-32830
2024-09-11 11:51:21 +01:00
rstoyanchev 5671744a94 Refactoring in UrlHandlerFilterTests 2024-09-11 11:51:21 +01:00
rstoyanchev 9d57c0ba89 Add compare method to ETag
Closes gh-33385
2024-09-10 12:29:33 +01:00
rstoyanchev 19700d07b1 Quote ETag if not quoted in HttpHeaders#setETag
This aligns HttpHeaders with other places like ServletWebRequest and
DefaultWebExchange where an ETag is accepted as input.

It also allows us to remove quoting from places that delegate to
HttpHeaders#setETag since it now does that internally.

Closes gh-33412
2024-09-10 09:17:56 +01:00
rstoyanchev 3dd4a8350a Update more places to use quoteETagIfNecessary
Closes gh-33412
2024-09-10 08:56:03 +01:00
rstoyanchev 1b26122e64 Polishing and minor refactoring
Update checks whether quoting is needed to be more complete
than what we've used so far, making sure the there is both
opening and closing quotes independent of each other.

See gh-33412
2024-09-10 08:56:01 +01:00
hyunmin0317 80b264ba82 Refactor eTag formatting into utility method
See gh-33412
2024-09-10 08:55:39 +01:00
Sébastien Deleuze cc3f4b87ff Update mime.types
This commit updates mime.types based on revision 1918129 of
https://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types.

Closes gh-33512
2024-09-09 19:23:57 +02:00
Sébastien Deleuze 413cbca2c0 Remove commented entries from mime.types
See gh-33512
2024-09-09 18:59:29 +02:00
Sam Brannen eff19ec972 Sync MockHttpServletRequest implementations 2024-09-09 15:42:21 +02:00
rstoyanchev d2b25c0378 Merge branch '6.1.x' 2024-09-09 11:56:21 +01:00
rstoyanchev 3d1bf28445 Refine how async request state lock is obtained
Rather than waiting indefinitely, keep checking if the state
changed from ASYNC (e.g. to ERROR).

Closes gh-33421
2024-09-09 11:54:38 +01:00
Sébastien Deleuze 5e3c5d466f Avoid collecting Flux elements in KotlinSerializationJsonEncoder
Closes gh-33428
2024-09-05 14:47:49 +02:00
Sébastien Deleuze 2f56a59ba0 Merge branch '6.1.x' 2024-09-04 16:13:04 +02:00
Sébastien Deleuze 4b7292f431 Fix an off-by-one bug in ForwardedHeaderTransformer
Consistently with what is done in ForwardedHeaderFilter.

Closes gh-33465
2024-09-04 16:12:44 +02:00
zhoukq aca264942d Update Content-Length if body changed by client interceptor
Prior to this commit, the HTTP interceptor model used for `RestTemplate`
and `RestClient` would not update the "Content-Length" request header,
even when the request body had been updated by a
`ClientHttpRequestInterceptor`.

Even though this is the `ClientHttpRequestInterceptor`'s responsibility
(along with the content type and encoding changes if needed), this
would result in invalid requests. This invalid situation can be detected
by `InterceptingClientHttpRequest`.

This commit ensures that such situations are detected and fixed
automatically by setting the Content-Length header to the actual body
size, right before executing the actual request, after all interceptors
are done.

Closes gh-33459
2024-09-02 16:19:26 +02:00
Brian Clozel be5d5fa52d UrlHandlerFilter should not strip slash for "/" request paths
This commit ensures that the `UrlHandlerFilter` does not handle "/"
paths in general, as they should not be altered and are meaningful for
web applications.

Closes gh-33444
2024-09-02 15:29:42 +02:00
Brian Clozel 52c4ffa4d2 Merge branch '6.1.x' 2024-08-30 21:23:29 +02:00
Brian Clozel debba6545b Listen to multiple async operations in ServerHttpObservationFilter
Prior to this commit, the `ServerHttpObservationFilter` was fixed to
re-enable instrumentation for async dispatches. This fix involves using
an AsyncListener to be notified of exchange completion.

This change was incomplete, as this would not work in some cases.
If another filter starts the async mode and initiates an ASYNC dispatch,
before async handling at the controller level, the async listener is not
registered against subsequent async starts.

This commit not only ensures that the async listener registers
against new async starts, but also ensure that the initial creation and
registration only happens during the initial REQUEST dispatch.

Fixes gh-33451
2024-08-30 20:09:21 +02:00
Brian Clozel fab889009a Support multiple async starts in MockHttpServletRequest
Closes gh-33457
2024-08-30 20:08:36 +02:00
Sam Brannen 167cb5d494 Polishing 2024-08-29 17:02:08 +02:00
Sam Brannen 2ddf495802 Delete unused method and polish formatting 2024-08-29 16:53:49 +02:00
rstoyanchev 7aa25e083a Merge branch '6.1.x' 2024-08-28 18:59:47 +03:00
rstoyanchev 186deb777f Update deprecation notices on rawStatusCode
Mark for removal where not marked, and set to 7.0
consistently as the target for removal.

See gh-33440
2024-08-28 18:49:49 +03:00
rstoyanchev 57cb8c7abf Restore rawStatusCode methods
Revert methods removed in 7df2e2a8d2.

See gh-33440
2024-08-28 18:12:26 +03:00
Sam Brannen 9f0417fb33 Merge branch '6.1.x' 2024-08-19 13:58:31 +02:00
Sam Brannen b2c1f978a4 Stop logging result in WebAsyncManager
Closes gh-33406
2024-08-19 13:53:06 +02:00
Brian Clozel 96573ee5e1 Merge branch '6.1.x' 2024-08-19 11:48:36 +02:00
Brian Clozel 50be08480d Open observation scope in RestClient
Prior to this commit, the `RestClient` instrumentation would create and
close observations for HTTP requests, but would not open an observation
scope for the lifetime of the exchange.
This means that custom `ClientHttpRequestInterceptor` and
`ResponseErrorHandler` would not get access to the current observation
scope in case of tracing, possibly leading to missing trace ids in logs.

This commit ensures that an observation scope is managed for the
lifetime of the HTTP exchange.

Fixes gh-33397
2024-08-19 11:48:26 +02:00
Sébastien Deleuze eb7a95cfdb Merge branch '6.1.x' 2024-08-19 09:47:08 +02:00
Sébastien Deleuze d41ca095ab Add native support for Kotlin default values in controllers
Closes gh-33384
2024-08-19 09:46:53 +02:00
Sam Brannen 346b6f740a Polish contribution
See gh-33401
2024-08-18 14:58:05 +02:00
tafjwr 4ffeddb099 Add tests for ControllerAdviceBean#resolveBean() and revise existing tests
Closes gh-33401
2024-08-18 14:52:05 +02:00
Sam Brannen 04271c3ead Merge branch '6.1.x' 2024-08-18 13:04:21 +02:00
Sam Brannen 143736e59b Enforce order of Javadoc tags for records
Closes gh-33403
2024-08-18 13:01:43 +02:00
Sam Brannen de33056c83 Use new features from JUnit Jupiter 5.11
This commit migrates additional parameterized tests (that were missed in
the previous commit) to the new argumentSet() feature.

See gh-33395
2024-08-16 15:48:47 +02:00
Sam Brannen d749d2949d Use new features from JUnit Jupiter 5.11
This commit primarily migrates to the new argumentSet() feature but also
applies additional polishing to our use of parameterized tests.

See gh-33395
2024-08-16 13:48:19 +02:00
rstoyanchev 974dec262c Merge branch '6.1.x' 2024-08-14 07:33:15 +03:00
rstoyanchev bb17ad8314 Efficient ETag parsing 2024-08-14 07:19:59 +03:00
Juergen Hoeller e1cf203295 Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
2024-08-13 19:05:20 +02:00
Juergen Hoeller d0bff584d7 Polishing 2024-08-13 18:51:02 +02:00
rstoyanchev 5fee796659 Merge branch '6.1.x' 2024-08-13 16:59:32 +03:00
rstoyanchev fe4fd00429 Polishing contribution
Closes gh-33374
2024-08-13 16:59:13 +03:00
Riley Park 1703b71563 Fix incorrect weak ETag assertion
See gh-33374
2024-08-13 16:31:14 +03:00
rstoyanchev cef1b7ea6d Polishing in HTTP interface argument resolvers 2024-08-12 21:01:03 +03:00
Olga Maciaszek-Sharma 51de84e148 Reject null for non-optional arguments
Closes gh-33339
2024-08-12 21:01:03 +03:00
Stéphane Nicoll 4ac4c1b868 Revert "Merge pull request #33366 from kashike"
This reverts commit a1ec7669f6, reversing
changes made to e27192e8ad.

See gh-33366
2024-08-12 17:47:35 +02:00
Stéphane Nicoll b7ddf1b4f4 Fix typo 2024-08-12 12:18:44 +02:00
Stéphane Nicoll 9f22e0c2de Polish "Make CacheControl immutable"
See gh-33366
2024-08-12 11:44:17 +02:00
Riley Park c3ab9bba11 Make CacheControl immutable
See gh-33366
2024-08-12 11:28:47 +02:00
Simon Baslé bf5e218b35 Add support for headers in `@HttpExchange`
On the client side, supports `name=value` pairs. Placeholders in values
are resolved by the `embeddedValueResolver`.
On the server side, additionally supports `name` and `!name` syntax.

Closes gh-33309
2024-08-09 18:02:16 +02:00
rstoyanchev b61eee7fb0 Support cross-parameter validation
Closes gh-33271
2024-08-09 18:53:30 +03:00
Simon Baslé d3e1e35d76 Merge branch '6.1.x' 2024-08-08 15:59:28 +02:00
Simon Baslé a0edf129eb Fix misleading statement in ReactorResourceFactory javadoc
Closes gh-33338
2024-08-08 15:26:10 +02:00
Stéphane Nicoll dbb3a9ab08 Merge branch '6.1.x' 2024-08-08 09:33:40 +02:00
Jonatan Ivanov 6c74fee5e8 Remove unnecessary error signal from DefaultRestClient
Before UnknownContentTypeException is thrown, it is added to the current
Observation but since UnknownContentTypeException is a
RestClientException, the exception is added again in one of the
catch blocks later on.

Closes gh-33347
2024-08-08 09:30:22 +02:00
Stéphane Nicoll 873c9fe0d8 Merge branch '6.1.x' 2024-08-08 09:14:30 +02:00
Jonatan Ivanov 36e84a5209 Fix RestClient instrumentation
ClientHttpResponse implements Closeable and the close method of
DefaultConvertibleClientHttpResponse also stops the current Observation.

Before this change exiting the try-with-resource block stopped the
Observation since it called close on ClientHttpResponse.
After this, there were multiple error and stop calls on the Observation
in the catch blocks after the Observation was already stopped
which is invalid.

This change reorders the flow by stopping the Observation in the
finally block (closing ClientHttpResponse) and not stopping
the Observation in any of the catch blocks.

Closes gh-33346
2024-08-08 09:11:57 +02:00
Stéphane Nicoll 25b57d4808 Merge branch '6.1.x' 2024-08-07 16:32:20 +02:00
Stéphane Nicoll 76b2d13b2c Add support for changing context path in ServletRequestPath
This commit implements modifyContextPath in ServletRequestPath and
apply the same logic of concatenating the servlet path with the
context path.

Closes gh-33251
2024-08-07 16:28:17 +02:00
zinzo edbaf68707 Polishing Javadoc and comment
See gh-33316
2024-08-05 10:05:00 +02:00
Simon Baslé 25f62c8765 Merge branch '6.1.x' 2024-08-01 16:29:52 +02:00
Simon Baslé 722dcae1b1 Fix buffer leak in MultipartParser
This change fixes a buffer leak when the MultipartParser is encountering
a body DataBuffer that only contains a boundary.

Closes gh-33094
2024-08-01 16:28:50 +02:00
Stéphane Nicoll c71f98acba Merge branch '6.1.x' 2024-07-30 17:21:28 +02:00
Stéphane Nicoll 321e8a58ae Document that NoOpResponseErrorHandler is not a good fit with RestClient
Closes gh-33276
2024-07-30 17:17:39 +02:00
rstoyanchev f967f6f9f0 Update contribution
Closes gh-33220
2024-07-30 13:15:21 +03:00
Seokjae Lee 5e9308e0cb Flexible collection handling in RequestParamArgumentResolver
See gh-33220
2024-07-30 11:42:44 +03:00
rstoyanchev 5ac7e74bf2 Replace test FilterRegistration with the one in testFixtures
See gh-33252
2024-07-30 11:33:47 +03:00
rstoyanchev 24ab6f61de Add FilterRegistration to spring-web textFixtures
See gh-33252
2024-07-30 11:33:47 +03:00
Brian Clozel b888f362e5 Document ControllerAdviceBean as internal usage
This commit documents `ControllerAdviceBean` as internal usage, as it is
not meant for application to manually create controller advice bean
instances.

This also refactors the existing partial implementation of the support
for creating controller advice beans "programmatically".

Closes gh-32776
2024-07-26 17:52:20 +02:00
Stéphane Nicoll eda21c4d22 Merge branch '6.1.x' 2024-07-23 10:51:56 +02:00
Stéphane Nicoll 6e9a19212f Consistently check for Content-Length value
This commit makes sure to consistently check that the content length
is not set above 2GB. Previously it was only checked in
setContentLength.

Closes gh-33256
2024-07-23 10:43:48 +02:00
Brian Clozel ccc0a54c1c Merge branch '6.1.x' 2024-07-23 09:22:15 +02:00
Dawid Olbiński 83ff8e4e98 Support JAXBElement subtypes in Jaxb2XmlEncoder
Closes gh-33258
2024-07-23 09:19:11 +02:00
rstoyanchev dcabddddc2 Expose HttpExchange metadata to argument resolvers
See gh-33220
2024-07-19 11:00:43 +01:00
Stéphane Nicoll f4b2886775 Polish "Support JAXBElement in Jaxb2RootElementHttpMessageConverter"
See gh-33233
2024-07-19 10:20:06 +02:00
Thomas Deblock a5e2557738 Support JAXBElement in Jaxb2RootElementHttpMessageConverter
See gh-33233
2024-07-19 10:12:53 +02:00
rstoyanchev ade8128060 Remove deprecated methods
Closes gh-33123
2024-07-18 11:37:20 +01:00
rstoyanchev 9409543dac Update deprecation notices
See gh-33123
2024-07-18 11:37:20 +01:00
rstoyanchev b9509d3c85 Initialize RequestPath on demand
Closes gh-33227
2024-07-17 15:15:31 +01:00
rstoyanchev b2decb4e5d Merge branch '6.1.x' 2024-07-15 15:21:39 +01:00
rstoyanchev 77bdbf7e37 Polishing contribution
Closes gh-33181
2024-07-15 15:21:19 +01:00
kevin.kep 2fe7ab1f92 Trim last allowed origin in comma-delimited list
See gh-33181
2024-07-15 15:17:03 +01:00
rstoyanchev 39c040005e Lazy use of Reactor Scheduler in DefaultPartHttpMessageReader
Closes gh-33218
2024-07-15 15:10:30 +01:00
rstoyanchev bd31e8dacc Provide access to underlying ConstraintViolation
Closes gh-33025
2024-07-12 17:35:35 +01:00
Sam Brannen 3e48498663 Change MIME mapping for .js from application/javascript to text/javascript
This application/javascript MIME type is deprecated.

This commit therefore changes the MIME type mapping for *.js files from
application/javascript to text/javascript in order to align with
industry standards.

Closes gh-33197
2024-07-12 18:22:18 +02:00
Simon Baslé fbe781b172 Merge branch '6.1.x' 2024-07-12 12:52:40 +02:00
Simon Baslé 152914a752 Fix multipart async servlet request temporary files deletion
This change tracks the multipart nature of the async request
within the `DispatcherServlet`, in the `WebAsyncManager`.

This allows for the second ASYNC dispatch to recognize the
multipart aspect and clean up the associated resources.

Closes gh-33161
2024-07-12 12:50:59 +02:00
Stéphane Nicoll 348764620d Merge branch '6.1.x' 2024-07-12 12:02:45 +02:00
Stéphane Nicoll 0f3f979d16 Align classloader used to create the JAXBContext
This commit makes sure that JAXBContext.newInstance consistently use
the target class classloader to detect the necessary resources.

Previously, the current thread's context classloader was used, which
could lead to not finding the required JAXB components.

Closes gh-33158
2024-07-12 12:00:07 +02:00
Sébastien Deleuze 7617a01f60 Unwrap Kotlin inline value classes return values
The result returned by Kotlin reflective invocation of a function
returning an inline value class is wrapped, which makes sense
from Kotlin POV but from a JVM perspective the associated value
and type should be unwrapped to be consistent with what
would happen with a reflective invocation done by Java.

This commit unwraps such result.

Closes gh-33026
2024-07-10 18:38:37 +02:00
Sébastien Deleuze 82c5aa4a48 Refactor InvocableHandlerMethodKotlinTests
See gh-33026
2024-07-10 18:32:10 +02:00
Sébastien Deleuze e2ce811407 Merge branch '6.1.x' 2024-07-09 12:06:29 +02:00
Sébastien Deleuze 4f38079042 Throw proper DecodingException in Kotlin Serialization decoders
Closes gh-33138
2024-07-09 12:05:24 +02:00
Simon Baslé 8918a772bf Polishing
See gh-32097
2024-07-08 18:36:46 +02:00
gregw 0a60c622cc Implement Eclipse Jetty core HTTP handler adapter
This provides an implementation of an HTTP Handler Adapter that is coded
directly to the Eclipse Jetty core API, bypassing any servlet
implementation.

This includes a Jetty implementation of the spring `WebSocketClient`
interface, `JettyWebSocketClient`, using an explicit dependency to the
jetty-websocket-api.

Closes gh-32097

Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Arjen Poutsma <arjen.poutsma@broadcom.com>
2024-07-08 18:36:46 +02:00
Stéphane Nicoll d89cb34c29 Merge branch '6.1.x' 2024-07-08 13:16:29 +02:00
Stéphane Nicoll 69850cad27 Polish "Implement DefaultErrorResponseBuilder#headers(Consumer)"
See gh-33156
2024-07-08 13:11:31 +02:00
Harry Yang bbbc95f773 Implement DefaultErrorResponseBuilder#headers(Consumer)
See gh-33156
2024-07-08 13:09:26 +02:00
rstoyanchev 194b4cedfb Use parsed path for checks in UrlHandlerFilter
See gh-32830
2024-07-05 09:35:57 +01:00
rstoyanchev 4054dc7088 Revise handler hierarchy in UrlHandlerFilter
See gh-32830
2024-07-05 09:35:57 +01:00
rstoyanchev 6ad8d6e5e3 Optimize path matching in UrlHandlerFilter
See gh-32830
2024-07-05 09:35:57 +01:00
rstoyanchev 80d1d50478 Polishing and minor refactoring in UrlHandlerFilter
See gh-32830
2024-07-05 09:35:57 +01:00
Sam Brannen 8eb204b8dd Merge branch '6.1.x'
# Conflicts:
#	buildSrc/src/main/java/org/springframework/build/TestConventions.java
2024-07-04 17:05:38 +02:00
Sam Brannen 89338c91a9 Stop using using legacy locale data for Date/Time formatting tests
Commit 84714fbae9 introduced usage of the
-Djava.locale.providers=COMPAT command-line argument for javac in order
to allow our JDK 20 builds to pass by using legacy locale data.

That was done to ensure that Date/Time formats using AM/PM produced a
standard space (" ") before the "AM" or "PM" instead of a narrow
non-breaking space (NNBSP "\u202F"), which was introduced in Java 20
due to adoption of Unicode Common Locale Data Repository (CLDR-14032).

This commit removes usage of the -Djava.locale.providers=COMPAT
command-line argument and updates all affected tests to:

- Use an NNBSP before "AM" or "PM" in input text when running on Java 20
  or higher.

- Leniently match against any Unicode space character in formatted
  values containing "AM" or "PM".

See https://jdk.java.net/20/release-notes#JDK-8284840
See https://unicode-org.atlassian.net/browse/CLDR-14032
See gh-30185
Closes gh-33144
2024-07-04 17:03:15 +02:00
Sam Brannen 932ce04541 Stop referring to old Spring versions in Javadoc 2024-07-01 17:50:52 +02:00
Arjen Poutsma bd4823e3de Remove deprecated methods scheduled for removal in 6.2
See gh-33123
2024-07-01 16:26:49 +02:00
Arjen Poutsma 5864f57198 Resolve URI to baseUrl in RestClient
Closes gh-32679
2024-07-01 15:10:30 +02:00
Sébastien Deleuze 98e89d8fba Leverage KType in Kotlin Serialization WebFlux support
In order to take in account properly Kotlin null-safety with the
annotation programming model.

Closes gh-33016
2024-07-01 15:06:08 +02:00
Sébastien Deleuze 23dccc5977 Leverage KType in Kotlin Serialization WebMVC support
In order to take in account properly Kotlin null-safety with the
annotation programming model.

See gh-33016
2024-07-01 15:06:08 +02:00
Sébastien Deleuze 4555384528 Introduce SmartHttpMessageConverter
SmartHttpMessageConverter is similar to GenericHttpMessageConverter,
but more consistent with WebFlux Encoder and Decoder contracts, with
the following differences:
 - A ResolvableType parameter is used instead of the Type one
 - The MethodParameter can be retrieved via the ResolvableType source
 - No contextClass parameter
 - `@Nullable Map<String, Object> hints` additional parameter for write
   and read methods

This commit also refines RestTemplate#canReadResponse in order to use
the most specific converter contract when possible.

Closes gh-33118
2024-07-01 15:05:57 +02:00
Brian Clozel 0717748f58 Merge branch '6.1.x' 2024-07-01 11:49:13 +02:00
Brian Clozel ab236c7741 Re-enable async dispatches in Observation Filter
Prior to this commit, the fix for gh-32730 disabled the involvment of
the osbervation filter for async dispatches. Instead of relying on ASYNC
dispatches to close the observation for async requests, this is now
using an async listener instead: async dispatches are not guaranteed to
happen once the async request is handled.

This change caused another side-effect: because async dispatches are not
considered anymore by this filter, the observation scope is not
reinstated for async dispatches. For example, `ResponseBodyAdvice`
implementations do not have the observation scope opened during their
execution.

This commit re-enables async dispatches for this filter, but ensures
that observations are not closed during such dispatches as this will be
done by the async listener.

Fixes gh-33091
2024-07-01 11:42:48 +02:00
Juergen Hoeller 053af5f75b Merge branch '6.1.x' 2024-06-27 12:04:59 +02:00
Juergen Hoeller fea237c065 Lazily start and retain HttpClient once resource factory is running
Closes gh-33093
2024-06-27 12:03:10 +02:00
Sam Brannen e6b77d301d Merge branch '6.1.x' 2024-06-22 16:52:42 +02:00
Sam Brannen c571ee1f95 Fix typo in comment 2024-06-22 16:51:28 +02:00
Juergen Hoeller 7fc2814a34 Merge branch '6.1.x' 2024-06-20 18:57:49 +02:00
Juergen Hoeller 66eddf99af Include original exception if cause is null
Closes gh-33080
See gh-32952
2024-06-20 18:56:43 +02:00
Brian Clozel c72e31bcf5 Merge branch '6.1.x' 2024-06-19 12:51:23 +02:00
Brian Clozel f7307c9e07 Avoid recording RestClient observations twice
Prior to this commit, the fix for gh-32575 introduced cases where the
client observation would be stopped twice.

This commit ensures that `RestClient` observations are stopped only once
when the response is closed, or before throwing an unhanlded exception.

Fixes gh-33068
2024-06-19 12:46:21 +02:00
Sam Brannen ce49354400 Sync MockHttpServletResponse implementations
See gh-33019
2024-06-19 12:31:17 +02:00
Sam Brannen d7668eec00 Merge branch '6.1.x' 2024-06-18 16:45:28 +02:00
Sam Brannen 203fa75196 Support all "connection reset" phrases in DisconnectedClientHelper
Prior to this commit, the isClientDisconnectedException() method in
DisconnectedClientHelper checked whether the message of the ultimate
exception in an exception chain contained one of the phrases "broken
pipe" or "connection reset by peer". However, that failed to match if
the exception message contained "Connection reset", which is the case
for the SocketException thrown by throwConnectionReset() in
sun.nio.ch.SocketChannelImpl.

This commit therefore replaces the "connection reset by peer" phrase
with "connection reset" in order to support all exception messages
containing "connection reset".

Closes gh-33064
2024-06-18 16:43:06 +02:00