Commit Graph

2944 Commits

Author SHA1 Message Date
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
秦利斌 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
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 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
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 983af78352 Configurable limit on HandlerMappingIntrospector
Closes gh-34918
2025-05-28 11:05:00 +01:00
rstoyanchev 9c13c6b695 Revert "Use optimistic locking where possible in `ResponseBodyEmitter`"
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
This reverts commit e67f892e44.

Closes gh-34762
2025-04-16 11:53:22 +01:00
rstoyanchev b49924ba37 Revert "Fix handling of timeout in SseEmitter"
This reverts commit f92f9c1d5b.

See gh-34762
2025-04-16 11:41:00 +01:00
Sam Brannen a22d204681 Remove duplicate words in Java source code
Discovered using regular expression: \b(\w+)\s+\1\b[^(}]
2025-04-14 11:24:55 +02:00
Sam Brannen cd987fc104 Update Javadoc to stop mentioning 5.3.x as the status quo
Closes gh-34740
2025-04-10 16:40:04 +02:00
Juergen Hoeller ee804ee8fb Avoid throwing of plain RuntimeException
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-04-04 00:22:24 +02:00
Taeik Lim a946fe2bf8 Fix broken link for Server-Sent Events
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
Signed-off-by: Taeik Lim <sibera21@gmail.com>
Closes gh-34705
2025-04-02 17:43:42 +02:00
Juergen Hoeller 743f32675d Only attempt load for CGLIB classes in AOT mode
Closes gh-34677
2025-03-31 16:39:18 +02:00
rstoyanchev f68fb97e7e Remove outdated notes on forwarded headers.
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
Closes gh-34625
2025-03-31 11:36:15 +01:00
Tran Ngoc Nhan 30fcaef813 Remove unnecessary closing curly brackets in Javadoc
Closes gh-34679

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-03-29 12:37:48 +01:00
Juergen Hoeller 47651350f3 Polishing
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-03-21 10:58:40 +01:00
Sam Brannen 208d52d852 Introduce Checkstyle rule for separator symbol location 2025-03-19 15:35:44 +01:00
rstoyanchev 18c3b637e4 Fix dated Javadoc in MvcUriComponentsBuilder
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
related to forwarded headers

Closes gh-34615
2025-03-19 12:33:01 +00:00
rstoyanchev 34c69bfc67 Allow empty comment in ServerResponse.SseBuilder
Closes gh-34608
2025-03-19 12:14:37 +00:00
Sam Brannen c6a9aa59a3 Remove BDDMockito Checkstyle rule
This commit removes the BDDMockito Checkstyle rule, since it did not
actually enforce the use of BDDMockito.

This commit also updates static imports to use Mockito instead of
BDDMockito where appropriate (automated via the Eclipse IDE Organize
Imports clean-up task).

Closes gh-34616
2025-03-18 16:35:57 +01:00
Sam Brannen 8334cb1abb Revise tests to better express intent 2025-03-06 17:32:32 +01:00
Juergen Hoeller 403362fe3c Polishing 2025-03-04 18:44:56 +01:00
Juergen Hoeller 534f123fe8 Add explicit FileSystemResource path check for trailing slash
Closes gh-34509
2025-03-04 18:44:25 +01:00
rstoyanchev f92f9c1d5b Fix handling of timeout in SseEmitter
Closes gh-34426
2025-02-27 14:34:26 +00:00
Brian Clozel f895d762cd Remove duplicate Content-Type header in error cases
Prior to this commit, the `DispatcherServlet` would try and reset the
response buffer in case of errors, if the response is not committed
already. This allows for more flexible error handling, even if the
response was being handled already when it errored.

Resetting the response buffer clears the body but leaves HTTP response
headers intact. This is done on purpose as to not clear headers
previously added by Servlet Filters. By leaving in place some headers
like "Content-Type", this does not take into account the fact that the
response body was cleared and that error handling will perform another
round of content negotiation. While this isn't a problem for some
Servlet containers which enforce a single "Content-Type" header value,
this can cause multiple/duplicate values for some others.

This commit ensures that the "Content-Type" response header is removed
at the same time as we clear the "producible media types" attribute:
another pass of content negotiation will be performed for error
handling.

Fixes gh-34366
2025-02-25 10:43:19 +01:00
Sam Brannen b2134ee71f Avoid Gradle build warnings about @⁠SuppressFBWarnings from FindBugs
In order to avoid Gradle build warnings about @⁠SuppressFBWarnings, this
commit introduces a testCompileOnly dependency on `findbugs` in the
spring-webmvc module so that the class file for @⁠SuppressFBWarnings is
available to the compileTestJava task.

Closes gh-34418
2025-02-12 17:49:23 +01:00
Sam Brannen 440a259b71 Clean up warnings in Gradle build 2025-02-12 16:46:41 +01:00
rstoyanchev 84992536c5 Defer initialization of HandlerMethod validation flags
Re-create the HandlerMethod only after the original is used as a key
in the CORS lookup map.

Closes gh-34375
2025-02-07 13:10:55 +00:00
Brian Clozel d80de043ce Fix filtered HTTP headers in data binding
Prior to this commit, several common HTTP headers were ignored from the
data binding process when collecting property values, in gh-34039 and
gh-34182.

This commit completes the initial enhancement by ensuring that the
default header predicate is also considering cases where constructor
binding is applied and the Java type has a lowercase variant of the HTTP
header name to filter.

Fixes gh-34292
2025-01-29 16:06:19 +01:00
Brian Clozel 7c5b6f1e1c Delete failing Freemarker test
This test was already ignored as of Java 21 because of a Java behavior
change, and now it started failing as of 17.0.14.
This commit removes the test entirely.
2025-01-29 15:55:58 +01:00
rstoyanchev 1cc767e90b Polishing in ExtendedServletRequestDataBinder 2025-01-28 15:36:19 +00:00
Stéphane Nicoll 24fa9ea394 Polish contribution
See gh-34223
2025-01-14 17:30:39 +01:00
Mengqi Xu 4acd9ee69b Polish HttpEntityMethodProcessor
Signed-off-by: Mengqi Xu <2663479778@qq.com>

See gh-34223
2025-01-14 17:28:00 +01:00
xumengqi 53b3b934fc BindException declared but not handled by ExceptionHandler
Closes gh-34214

Signed-off-by: Mengqi Xu <2663479778@qq.com>
2025-01-08 16:29:12 +01:00
Brian Clozel 84be0d85b4 Refine location checks for PathResource
This commit ensures that checks for PathResource locations are skipped
because this resource implementation will always resolve under the
current location.

Closes gh-34167
2025-01-08 10:55:22 +01:00
Brian Clozel c971276f34 Refine default filtered headers for web data binding
Prior to this commit, HTTP request data binding had been improved to
filter out by default the "Priority" header in #34039.

This commit extends the set of filtered header names with:
"Accept", "Authorization", "Connection", "Cookie", "From", "Host",
"Origin", "Priority", "Range", "Referer", "Upgrade".

If an application wishes to let those header be bound, it will need to
configure the binder and replace the default header predicate by calling
`setHeaderPredicate`.

Closes gh-34182
2025-01-07 22:11:41 +01:00
rstoyanchev a985b73939 Improve logging in ReactiveTypeHandler
See gh-34188
2025-01-06 12:13:29 +00:00
rstoyanchev 5a44897c55 Polishing in WebAsyncManager
See gh-34192
2025-01-06 12:06:43 +00:00
rstoyanchev 59ed4686c5 Create ParameterErrors for type level constraint
Closes gh-34105
2024-12-30 14:47:26 +00: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
Brian Clozel 1a34b0dd87 Improve PathMatcher/PatternParser XML configuration
Prior to this commit, the MVC namespace for the XML Spring configuration
model would use the `PathMatcher` bean instance when provided like this:

```
<bean id="pathMatcher" class="org.springframework.util.AntPathMatcher"/>
<mvc:annotation-driven>
  <mvc:path-matching path-matcher="pathMatcher"/>
</mvc:annotation-driven>
<mvc:resources mapping="/resources/**" location="classpath:/static/"/>
```

With this configuration, the handler mapping for annotated controller
would use the given `AntPathMatcher` instance but the handler mapping
for resources would still use the default, which is `PathPatternParser`
since 6.0.

This commit ensures that when a custom `path-matcher` is defined, it's
consistently used for all MVC handler mappings as an alias to the
well-known bean name. This allows to use `AntPathMatcher` consistently
while working on a migration path to `PathPatternParser`

This commit also adds a new XML attribute to the path matching
configuration that makes it possible to use a custom `PathPatternParser`
instance:

```
<bean id="patternParser" class="org.springframework.web.util.pattern.PathPatternParser"/>
<mvc:annotation-driven>
  <mvc:path-matching pattern-parser="patternParser"/>
</mvc:annotation-driven>
```

Closes gh-34064
2024-12-17 10:14:18 +01:00
Sam Brannen a89db89fc0 Polishing 2024-12-14 17:10:41 +01:00
Sam Brannen 3d0fffa8e4 Polish contribution
See gh-33945
2024-12-14 16:40:49 +01:00
Mico Piira 71f872e8bb Fix implicit variable resolution in JSP EvalTag
Prior to this commit, the order of parameters passed to
ELResolver#getValue was incorrect.

The `name` should correspond to the `property` parameter of the
`getValue` method instead the `base` parameter.

See gh-32383
See gh-33942
Closes gh-33945
2024-12-14 16:40:31 +01:00
rstoyanchev 8aeced9f80 Support header filtering in web data binding
Closes gh-34039
2024-12-11 16:11:22 +00:00
rstoyanchev 70c326ed30 Support headers in DataBinding via constructor args
Closes gh-34073
2024-12-11 16:10:08 +00:00
Juergen Hoeller edf7f3cd43 Polishing 2024-12-04 16:41:07 +01:00
rstoyanchev cbe2f36106 Decode static resource path with UriUtils
See gh-33859
2024-11-12 11:39:22 +00:00
rstoyanchev 59ec871e76 Append trailing slash to static location
Closes gh-33815
2024-11-08 07:11:55 +00:00
longtanfei e67f892e44 Use optimistic locking where possible in `ResponseBodyEmitter`
Closes gh-33831
2024-11-07 16:33:05 +01:00