Commit Graph

3065 Commits

Author SHA1 Message Date
Réda Housni Alaoui abc60f15da
Merge c14ca9d199 into b256babad5 2025-07-01 20:56:40 +02:00
rstoyanchev 3ce7613195 Add version deprecation tests for router functions
Given the move of ApiVersionStrategy support to AbstractHandlerMapping,
deprecation should already work. We only need tests to show it.

See gh-35113
2025-07-01 11:37:34 +01:00
rstoyanchev 86f50b20f2 Move ApiVersionStrategy up to AbstractHandlerMapping
Similar to CorProcessor, ApiVersionStrategy is now supported at the
AbstractHandlerMapping level.

See gh-35113
2025-07-01 11:37:34 +01:00
NeatGuyCoding eeedeb3b10 Remove the duplicated “rss” assertion
Closes gh-35139
Signed-off-by: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com>
2025-07-01 10:21:48 +02:00
rstoyanchev 1a9f19f87f Update use of preset content-type for streaming
For 7.0 we can favor more explicitly a preset Content-type.

Closes gh-35130
2025-06-30 15:40:33 +01:00
rstoyanchev 817136a0e9 Merge branch '6.2.x' 2025-06-30 15:35:29 +01:00
rstoyanchev 55634f972c Use preset content-type for streaming response
Closes gh-35130
2025-06-30 15:34:14 +01:00
Réda Housni Alaoui c14ca9d199 Merge remote-tracking branch 'upstream/main' into issue-33355 2025-06-30 15:03:14 +02:00
rstoyanchev 5a6c019413 Support for functional routing by API version
See gh-35113
2025-06-27 16:22:44 +01:00
rstoyanchev 224f1af08e Prepare to support API versioning for fn
Add default method to resolve, parse, and validate version
Simplify tests
2025-06-27 16:22:44 +01:00
rstoyanchev d045f44693 Polishing in RequestMappingHandlerMapping 2025-06-27 16:22:44 +01:00
Brian Clozel 28f9adf88e Simplify media files detection in WebMvcConfigurationSupport
Prior to this commit, `WebMvcConfigurationSupport` would configure file
extensions/media types registrations based on classpath detection.
Since gh-33894, the detection of message converters is located in a
single place, `HttpMessageConverters`.

This commit updates the `WebMvcConfigurationSupport` to use the actual
message converters configured to decide which file extensions should be
set up for content negotiation.

See gh-33894
2025-06-27 15:06:32 +02:00
Brian Clozel 7e919d2c96 Reorder multipart converter for server converters
Closes gh-33894
2025-06-27 09:30:34 +02:00
Brian Clozel beedf0a76b Use HttpMessageConverters in client and server config
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit uses the new `HttpMessageConverters` class for the HTTP
client (`RestTemplate` and `RestClient`) and HTTP server support.

This effectively removes the duplication of classpath detection for
message converters in multiple places: clients, server and the multipart
converter itself.
Instead of creating multiple instances of the same converters, this
allows applications to share converter instances as much as possible for
better memory efficiency.

As a result, this change also deprecates configuration methods in the
MVC support that are superseded by the new methods introduced for
`HttpMessageConverters` support.

Closes gh-33894
2025-06-26 17:19:33 +02:00
rstoyanchev 40eb9c2c81 Add docs for API version deprecation support
Closes gh-35049
2025-06-25 12:03:35 +01:00
rstoyanchev 482cfb0b18 Add detectSupportedVersions in spring-webmvc
Closes gh-35105
2025-06-25 12:03:35 +01:00
rstoyanchev 785aab8ad5 Rename ApiDeprecationHandler to insert "Version"
The name is a bit long, but it is necessary to indicate it's a handler
for a deprecation version, and the decision is based on the version,
not an individual endpoint.

See gh-35049
2025-06-25 12:03:35 +01:00
rstoyanchev ffdf941219 Resolve API version in RequestMappingHandlerMapping
API version resolution and parsing is already applied as long as
an ApiVersionStrategy is configured and irrespective of whether
a given RequestMapping has a version or not.

RequestMappingHandlerMapping also needs to be aware of the API version
in order to apply deprecated version handling. So it is better to
resolve, parse, and validate the version in the beginning of
handler mapping rather than in the first call to any
VersionRequestCondition.

Closes gh-35049
2025-06-23 18:03:56 +01:00
rstoyanchev 492e51f3ba Add handling of deprecated API versions
See gh-35049
2025-06-23 18:03:56 +01:00
rstoyanchev 0eec1dc636 Consistently validate API version
Closes gh-35082
2025-06-23 18:03:56 +01:00
rstoyanchev a0f9872746 Refactor construction of VersionRequestCondition
The single constructor now supports all combinations of having a version
attribute set or not, and ApiVersionStrategy, configured or not.

In effective, ensure the configured ApiVersionStrategy is passed even
when the RequestMapping version attribute is not set.

See gh-35082
2025-06-23 18:03:56 +01:00
rstoyanchev 5d34f9c87e Support API versioning via MediaType parameter
Closes gh-35050
2025-06-23 18:03:55 +01:00
Réda Housni Alaoui 76b297dced Fix accordingly to code review
Signed-off-by: Réda Housni Alaoui <reda-alaoui@hey.com>
2025-06-20 22:38:36 +02:00
Spring Builds 16edf9867a Update copyright headers in source files
This commit updates Java, Kotlin, and Groovy source files to use the
"<year>-present" pattern in copyright headers.

Closes gh-35070
2025-06-17 16:23:50 +02:00
Spring Builds aee29b7f30 Update copyright headers in source files
This commit updates Java, Kotlin, and Groovy source files to use the
"<year>-present" pattern in copyright headers.

Closes gh-35070
2025-06-17 15:54:58 +02:00
Brian Clozel 2aa0bad432 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-15 18:50:58 +02:00
Brian Clozel faada70d59 Reset respone content-type for invalid range responses
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
Prior to this commit, the `ResourceHttpRequestHandler` would detect
invalid range requests and reply with a 416 response status and the
relevant range header. Because this was triggering an error dispatch,
the error handling would collect error metadata and produce an error
response with the original content-type.
This would most likely fail because the content-type is most likely a
file-related media type which cannot be used for error responses.

This commit resets the response content type in these cases and let the
error handling pick the most sensible media type for the error response.

Fixes gh- 34490
2025-06-15 18:42:45 +02:00
Brian Clozel af7758cbc7 Configure CheckStyle rule for empty catch blocks
This commit configures a new CheckStyle rule that fails for empty
"catch" blocks, unless the exception is named "ignored" or "expected".

This also fixes the remaining instances missed by the previous commit.

Closes gh-35047
2025-06-15 16:11:48 +02:00
Vincent Potucek 0d4dfb6c1f Rename exception variables in empty catch blocks
The Spring codebase sometimes ignores exceptions in catch blocks on
purpose. This is often called out by an inline comment.
We should make this more obvious by renaming the exception argument in
the catch block to declare whether the exception is "ignored" or
"expected".

See gh-35047

Signed-off-by: Vincent Potucek <vpotucek@me.com>
[brian.clozel@broadcom.com: rework commit message]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
2025-06-15 16:11:42 +02:00
秦利斌 1a5cc87bb1
Remove unused field in ResourceHttpRequestHandler
Closes gh-35037

Signed-off-by: 秦利斌 <68638598+Allan-QLB@users.noreply.github.com>
2025-06-12 14:57:26 +02:00
Sam Brannen 077146d636 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-09 14:12:45 +02:00
Sam Brannen 18d6a55e3e Polishing and removal of "this." for method invocations
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-09 14:10:30 +02:00
Sébastien Deleuze b6a121ed44 Merge branch '6.2.x' 2025-06-09 11:03:47 +02:00
秦利斌 99890b6147 Fix ResourceHttpRequestHandler#setHeaders JavaDoc
Closes gh-35004
Signed-off-by: 秦利斌 <68638598+Allan-QLB@users.noreply.github.com>
2025-06-09 10:55:21 +02:00
Johnny Lim 7f6a7b806e Replace AssertionsForClassTypes with Assertions
Closes gh-34821

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-06-06 13:49:23 +02:00
Sébastien Deleuze 826041d2f7 Add Kotlin body advices
This commit introduces KotlinRequestBodyAdvice and
KotlinResponseBodyAdvice in order to set a KType hint when relevant.

Closes gh-34923
2025-06-05 18:53:31 +02:00
Sébastien Deleuze 93ba10fa1a Merge branch '6.2.x' 2025-06-05 14:08:36 +02:00
Sébastien Deleuze 4d09eb569b Refine RequestResponseBodyMethodProcessorKotlinTests
Improve read tests and fix copyright.

See gh-34992
2025-06-05 14:07:27 +02:00
Sébastien Deleuze b89c48e714 Merge branch '6.2.x'
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
2025-06-05 12:12:23 +02:00
Sébastien Deleuze a439e9030f Fix collection support in AbstractKotlinSerializationHttpMessageConverter
Backport Bot / build (push) Waiting to run Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
AbstractKotlinSerializationHttpMessageConverter#getSupportedMediaTypes(Class<?>)
currently invokes transitively supports(Class<?>) which always return false
with generic types.

This commit adds an override that just invokes getSupportedMediaTypes().

Closes gh-34992
2025-06-05 12:02:22 +02:00
Brian Clozel 79a793e44c Merge branch '6.2.x' 2025-06-05 10:58:57 +02:00
James Yuzawa aa5c0dcd72 Add caching headers to unmodified static resources
per https://www.rfc-editor.org/rfc/rfc7232#section-4.1

The server generating a 304 response MUST generate any of the
following header fields that would have been sent in a 200 (OK)
response to the same request: Cache-Control, Content-Location, Date,
ETag, Expires, and Vary.

Closes gh-34614

Signed-off-by: James Yuzawa <jtyuzawa@gmail.com>
2025-06-05 10:58:24 +02:00
rstoyanchev 230540b6da Polishing contribution
Closes gh-34942
2025-06-04 13:46:22 +01:00
Yanming Zhou f9fa7cc93b Add missing "since" in `@Deprecated`
See gh-34942

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
2025-06-04 13:46:22 +01:00
rstoyanchev 26ee30ed8f Merge branch '6.2.x' 2025-05-28 11:10:06 +01:00
rstoyanchev 983af78352 Configurable limit on HandlerMappingIntrospector
Closes gh-34918
2025-05-28 11:05:00 +01:00
Sébastien Deleuze 13be54a1d2 Make ProblemDetailJacksonXmlMixin compatible with Jackson 3
Closes gh-34925
2025-05-26 16:56:28 +02:00
Sam Brannen 01fea5e7ed Polish Jackson 3 support
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
- Improve Javadoc.

- Suppress warnings for "removal".

- Update copyright headers.

- Migrate several tests from:
  - MappingJackson2MessageConverter to JacksonJsonMessageConverter
  - Jackson2JsonEncoder to JacksonJsonEncoder
  - Jackson2JsonDecoder to JacksonJsonDecoder
  - Jackson2SmileEncoder to JacksonSmileEncoder
  - Jackson2ObjectMapperBuilder to JsonMapper and XmlMapper
  - MappingJackson2JsonView to JacksonJsonView
  - MappingJackson2HttpMessageConverter to JacksonJsonHttpMessageConverter
  - MappingJackson2XmlHttpMessageConverter to JacksonXmlHttpMessageConverter
2025-05-14 16:55:27 +02:00
Sébastien Deleuze 2a29e16456 Deprecate for removal Jackson 2 support
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details
This commit deprecate for removal (likely in a future 7.x release) the
Jackson 2 support in favor of the Jackson 3 one.

Closes gh-33798
2025-05-13 18:02:33 +02:00
Sébastien Deleuze 7acd4aec38 Introduce Jackson 3 support to AnnotationDrivenBeanDefinitionParser
See gh-33798
2025-05-13 17:53:29 +02:00