Commit Graph

5369 Commits

Author SHA1 Message Date
Brian Clozel
5e08a88219 Upgrade Servlet mock classes to Servlet 6.1
This commit upgrades our Mock Servlet classes for Servlet 6.1 support:

* the read/write `ByteBuffer` variants for `ServletInputStream` and
  `ServletOutputStream` were not added as the default implementation
  matches well the testing use case.
* Implement the session accessor with a simple lambda. Our mocks do not
  simulate the scheduling of request/response processing on different
  threads.
* Ensure that the response content length can only be written before the
  response is committed. Calling those methods after commit is a no-op,
  per specification.

Closes gh-33749
2024-11-22 17:07:44 +01:00
Brian Clozel
3b65506c13 Use ByteBuffer support in ServletHttpHandlerAdapter
As of Servlet 6.1, the `ServletInputStream` and `ServletOutputStream`
offer read and write variants based on `ByteBuffer` instead of byte
arrays. This can improve performance and avoid memory copy for I/O
calls.

This was already partially supported for some servers like Tomcat
through specific adapters. This commit moves this support to the
standard `ServletHttpHandlerAdapter` and makes it available for all
Servlet 6.1+ containers.

Closes gh-33748
2024-11-22 15:08:02 +01:00
Brian Clozel
f5ff84ab7b Merge branch '6.2.x' 2024-11-21 14:35:52 +01:00
Johnny Lim
1910d32405 Replace TestObservationRegistryAssert.assertThat() with Assertions.assertThat()
See https://github.com/micrometer-metrics/micrometer/pull/5551

Closes gh-33929
2024-11-21 14:35:32 +01:00
Brian Clozel
50061dae35 Merge branch '6.2.x' 2024-11-21 14:25:41 +01:00
sonallux
986ffc2072 Use full URI for URI template keyvalue with RestClient
Prior to this commit, `RestClient` would not use the full URI created by
the uri handler as a template request attribute.
This means that HTTP client observations would not contain the base URI
in recorded observations as the uri template keyvalue.

Closes gh-33928
2024-11-21 14:23:01 +01:00
Brian Clozel
4b3e192ca1 Upgrade to Tomcat 11.0
This commit upgrades the baseline to Tomcat 11.0 and adapts to the
following behavior changes in Tomcat:

* the MimeHeaders#clear method has been removed
* expired cookies do not set "Max-Age=0" anymore
* responses to HEAD requests do not write the "Content-Length" header
  anymore.

Closes gh-33916
2024-11-19 18:11:24 +01:00
Brian Clozel
c28cbfd582 Upgrade Servlet, JSP and WebSocket API versions
This commit updates the Spring Framework baseline for the Servlet, JSP
and WebSocket APIs.
This also removes the previously deprecated APIs in JSP `PageContext`
and guards against the deprecation of the `PushBuilder` API.

See gh-33918
2024-11-19 18:11:18 +01:00
Sam Brannen
f5c3f3522e Simplify @⁠EnumSource usage 2024-11-18 14:12:13 +01:00
Tran Ngoc Nhan
883254e1d0 Polish
- Update copyright header.
- Consistent use of "SIMPLE" link text for Style#SIMPLE in javadoc.

Closes gh-33883
2024-11-18 13:40:23 +01:00
Brian Clozel
e919d0adcc Reflect well-known MediaTypes intent in Javadoc
Closes gh-33754
2024-11-18 11:57:22 +01:00
Brian Clozel
4aafae1c33 Reflect well-known HttpHeaders intent in Javadoc
Closes gh-33886
2024-11-18 11:57:15 +01:00
Simon Baslé
35b452b458 Upgrade to Undertow 2.3.18.Final, dispatch in UndertowHttpHandlerAdapter
This ensures that the reactive handling of the request is dispatched
from the Undertow IO thread, marking the exchange as async rather than
ending it once the Undertow `handleRequest` method returns.

Closes gh-33885
2024-11-14 16:14:57 +01:00
rstoyanchev
de8a94f30d Do not set up CookieStore in Apache connector
Closes gh-33822
2024-11-14 09:30:36 +00:00
Juergen Hoeller
25e2c1b7ce Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
#	spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java
2024-11-13 15:12:55 +01:00
Juergen Hoeller
14b9865de7 Remove ineffective JettyByteBufferIterator from WebSocket adapter
In JettyWebSocketHandlerAdapter, JettyByteBufferIterator does not actually add extra behavior (in contrast to JettyClientHttpConnector).
2024-11-13 15:10:32 +01:00
Sam Brannen
d92c57f7a5 Merge branch '6.1.x' 2024-11-13 14:23:52 +01:00
Sam Brannen
4d792d0e45 Remove mentions of Joda-Time support
Since Joda-Time support was removed in Spring Framework 6.0, this commit
removes obsolete mentions of Joda-Time in the reference guide and Javadoc.

See gh-27426
Closes gh-33881
2024-11-13 14:16:14 +01:00
Brian Clozel
5b5a072351 Merge branch '6.1.x' 2024-11-12 10:05:24 +01:00
Brian Clozel
49a63e2c37 Add tests for gh-33867
Closes gh-33867
2024-11-12 10:02:48 +01:00
ZLATAN628
5666e363d1 Fix wrong uri tag for client observation convention
Prior to this commit, a client sending a request to
"https://example.org" would record the wrong URI tag as
"/https://example.org".

This commit ensures that the scheme+host part is matched correctly in
the default client observation conventions.

See gh-33867
2024-11-12 10:02:39 +01:00
rstoyanchev
d4719493bd Empty string check after conversion in AbstractNamedValueArgumentResolver
Closes gh-33794
2024-11-08 09:21:08 +00:00
rstoyanchev
37243f44e8 Refactor cookie support for Apache HttpClient
Closes gh-33822
2024-11-08 06:30:51 +00:00
Simon Baslé
715e38c44f Merge branch '6.1.x' 2024-11-07 10:05:15 +01:00
Simon Baslé
c93af1f76d Polishing: copyright header year
See gh-33823
2024-11-07 10:04:53 +01:00
Simon Baslé
bbe90a57ba Merge branch '6.1.x' 2024-11-06 11:40:46 +01:00
Simon Baslé
9b3cb15389 Introduce HttpHeaders#headerSet to guarantee case-insensitive iteration
The `HttpHeaders#headerSet` method is intended as a drop-in replacement
for `entrySet` that guarantees a single casing for all header names
reported during the iteration, as the cost of some overhead but with
support for iterator removal and entry value-setting.

The `formatHeaders` static method is also altered to do a similar
deduplication of casing variants, but now additionally mentions
"with native header names [native name set]" if the native name set
contains casing variants.

Closes gh-33823
2024-11-06 11:11:39 +01:00
Sébastien Deleuze
7e1d6fe934 Merge branch '6.1.x' 2024-11-05 10:27:22 +01:00
Johnny Lim
0beb56a58c Fix indentation to use tabs in Kotlin source files
Closes gh-33840
2024-11-05 10:24:02 +01:00
Sam Brannen
e3301dd1c4 Merge branch '6.1.x' 2024-11-03 16:17:43 +01:00
Sam Brannen
6bd4687706 Update copyright headers
See gh-33839
2024-11-03 16:14:41 +01:00
Tran Ngoc Nhan
07b12666b4 Fix typos in Javadoc and variable names
Closes gh-33839
2024-11-03 16:13:50 +01:00
rstoyanchev
bc65f93467 Improve cancel in SubscriberInputStreamTests 2024-10-31 10:05:45 +00:00
rstoyanchev
38c88e769d Polishing in SubscriberInputStreamTests 2024-10-31 10:05:45 +00:00
Sébastien Deleuze
09d87fac57 Annotate RestClient retrieve() with @CheckReturnValue
This annotation triggers a warning in IDEs supporting
`@CheckReturnValue` when retrieve() return value is not
used.

Closes gh-33818
2024-10-30 14:45:35 +01:00
Juergen Hoeller
a1f6098158 Merge branch '6.1.x' 2024-10-29 23:04:05 +01:00
Juergen Hoeller
11ebceee38 Call get/setRequestConfig for HttpClient 5.4 compatibility
Includes upgrade to HttpClient 5.4.1 while retaining a HttpClient 5.1 baseline.

Closes gh-33806
2024-10-29 23:01:57 +01:00
rstoyanchev
4749d810db Refactor ReactorClientHttpRequestFactory timeouts
Closes gh-33782
2024-10-28 12:45:53 +00:00
rstoyanchev
044da794f4 Polishing ReactorClientHttpRequestFactory 2024-10-28 12:45:53 +00:00
rstoyanchev
89d56b1fa6 Streaming ReactorClientHttpResponse
Closes gh-33781
2024-10-28 12:45:53 +00:00
rstoyanchev
f1cfe7a3d4 InputStreamSubscriber instantiation and Javadoc
See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev
dfaf7a0c6a Rename InputStreamSubscriber to SubscriberInputStream
It is both, but InputStream is what's exposed for public use,
in effect an InputStream backed by a Subscriber source.

See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev
86a42db002 InputStreamSubscriber/Tests conform to style
See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev
d4b31fd4b2 InputStreamSubscriber compiler issues
See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev
a366ea0e15 Align InputStreamSubscriber copies
There are legitimate differences, but also some are fixes that
should be on both sides.

See gh-31677
2024-10-28 12:45:53 +00:00
OlegDokuka
37622a7f90 Support Publisher to InputStream conversion
See gh-31677
2024-10-28 12:45:53 +00:00
Sam Brannen
5532574f56 Remove unused casts and variables 2024-10-25 15:16:05 +02:00
Brian Clozel
9df4fcdc9e Merge branch '6.1.x' 2024-10-25 10:55:00 +02:00
Brian Clozel
a06bbccf9e HttpHeaders.writeableHttpHeaders should unwrap many times
Prior to this commit, the `HttpHeaders.writeableHttpHeaders` would only
consider headers read-only instances that were wrapped once by
`HttpHeaders.readOnlyHttpHeaders`. This does not work when other
`HttpHeaders` wrappers are involved in the chain.

This commit ensures that `writeableHttpHeaders` unwraps all headers
instances down to the actual multivalue map and create a new headers
instance out of it.

Fixes gh-33789
2024-10-25 10:22:12 +02:00
rstoyanchev
bbe362c0e6 Allow null from RestClient exchange methods
Closes gh-33779
2024-10-23 19:08:54 +01:00