Commit Graph

2958 Commits

Author SHA1 Message Date
rstoyanchev 70c326ed30 Support headers in DataBinding via constructor args
Closes gh-34073
2024-12-11 16:10:08 +00: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
Sébastien Deleuze edce3029a2 Remove tests for Kotlin Script Templates
Closes gh-34030
2024-12-05 11:19:42 +01:00
Juergen Hoeller 162e533393 Merge branch '6.2.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/scheduling/concurrent/AbstractSchedulingTaskExecutorTests.java
#	spring-web/src/main/java/org/springframework/http/MediaType.java
#	spring-websocket/spring-websocket.gradle
#	spring-websocket/src/main/java/org/springframework/web/socket/messaging/WebSocketStompClient.java
#	spring-websocket/src/main/java/org/springframework/web/socket/sockjs/client/DefaultTransportRequest.java
2024-12-04 16:45:54 +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 c213724a47 Document Servlet PushBuilder API deprecation
See gh-33918
2024-11-28 15:55:53 +01:00
rstoyanchev 81ea35c726 Update method names in FragmentsRendering
Closes gh-33974
2024-11-27 11:21:51 +00:00
rstoyanchev 1fd0b8730b Improve Javadoc of FragmentsRendering 2024-11-26 18:27:16 +00: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
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
Sam Brannen e3301dd1c4 Merge branch '6.1.x' 2024-11-03 16:17:43 +01:00
Tran Ngoc Nhan 07b12666b4 Fix typos in Javadoc and variable names
Closes gh-33839
2024-11-03 16:13:50 +01:00
Juergen Hoeller c979eddab1 Consistent deprecation markers for 6.2 2024-10-30 16:45:00 +01:00
Sam Brannen f427ac383d (Re)suppress deprecation warnings
See gh-33780
2024-10-30 10:52:01 +01:00
Juergen Hoeller 9e3371ef07 Mark ListenableFuture as deprecated for removal
Closes gh-33808
2024-10-29 18:36:40 +01:00
Brian Clozel d8c153a9d1 Remove support for Resin Servlet container
This commit removes all references to the Resin Servlet container, as it
is not supported as of Spring Framework 6.0 because we require a
JakartaEE baseline.

Closes gh-33772
2024-10-23 10:10:29 +02:00
rstoyanchev 9252e741e1 Default webmvc handling of disconnected client errors
Closes gh-33753
2024-10-22 15:47:29 +01:00
rstoyanchev 5271f5b8a1 Polishing 2024-10-22 14:50:33 +01:00
Brian Clozel 9a761579c0 Remove ServerResponse.AsyncBuilder interface
This new interface is not strictly necessary and introduces a binary
incompatibility. This commit merges back all the method definitions into
`SseBuilder` and `StreamBuilder` interfaces.

Closes gh-33736
2024-10-18 09:09:41 +02:00
rstoyanchev bdcfbee7df Merge branch '6.1.x' 2024-10-16 12:11:23 +01:00
rstoyanchev 23656aebc6 Use Locale.ROOT consistently for toLower/toUpperCase
See gh-33708
2024-10-16 12:05:54 +01:00
rstoyanchev a63cf06496 Update Javadoc snippets for static resource locations
Switch to FileUrlResource, the same as what is used get with
the "file:" prefix in webmvc and webflux config.

See gh-33712
2024-10-15 19:23:07 +01:00
rstoyanchev 789d7effa9 Assert static resource location
Closes gh-33712
2024-10-15 19:23:07 +01:00
Brian Clozel f204f4962d Document XML parser usage against security false positives
Prior to this commit, our XML parser usage would be already haredened
against XXE (XML External Entities) attacks. Still, we recently received
several invalid security reports claiming that our setup should be
hardened.

This commit documents a few usages of XML parsers to add some more
context and hopefully prevent future invalid reports.

Closes gh-33713
2024-10-15 18:59:02 +02:00
rstoyanchev 7d3a3d35ce Update valid path checks for double encoding
See gh-33687
2024-10-14 18:14:01 +01:00
rstoyanchev fb7890d739 Update processPath for double encoding
See gh-33689
2024-10-14 18:13:55 +01:00
rstoyanchev cff6db02b4 Merge branch '6.1.x' 2024-10-14 16:00:48 +01:00
rstoyanchev 1a0b577bfc Do not support relative static resource paths
Closes gh-33687
2024-10-14 15:54:59 +01:00
rstoyanchev 3bfbe30a78 Normalize static resource path early
Rather than leaving it to the Resource implementation, and
potentially normalizing twice, we apply it once as part of the
initial processPath checks.

Closes gh-33689
2024-10-14 15:52:15 +01:00
Johnny Lim 1ec9a115a8 Replace RFC 7807 with RFC 9457 in documentation
See gh-33594
2024-10-08 13:32:33 +01:00
Tran Ngoc Nhan e3cf23d15a remove unused keyword 2024-09-26 21:49:22 +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
Sam Brannen dae871b5d3 Clean up warnings in Gradle build 2024-09-24 12:34:20 +02:00
Tran Ngoc Nhan c85050eb43 Consistently use CharSequence.isEmpty() for emptiness checks
Closes gh-33577
2024-09-23 17:10:21 +02:00
rstoyanchev c6fa180602 Extract shared resource handling utility methods
Closes: gh-33574
2024-09-20 19:25:12 +01:00
Johnny Lim 3ba9d35e22 Polish
Closes gh-33566
2024-09-20 10:58:37 +02:00
Sam Brannen 16d8df8c2f Merge branch '6.1.x' 2024-09-13 15:29:33 +02:00
Sam Brannen b388ff60dd Fix parameterized test display names and polishing 2024-09-13 15:26:56 +02:00
Brian Clozel 5838bf5888 Merge branch '6.1.x' 2024-09-13 09:33:10 +02:00
Brian Clozel 6a20987933 Add missing URI template variables in RedirectViews
Prior to this commit, the URL handler mapping would expose the matching
pattern, the path within mapping and matching URI variables as request
attributes. This was the case when the mapping would use the
`AntPathMatcher` as matching infrastructure, but not when using the
`PathPattern` variant. In this case, the map of URI variables would be
`null`. This could throw `IllegalArgumentException` when `RedirectView`
instances were relying on the presence of specific variables.

This commit ensures that URI variables are also extracted when the
`PathPatternParser` is used.

Fixes gh-33422
2024-09-13 09:28:45 +02:00
rstoyanchev 398e5528a1 Merge branch '6.1.x' 2024-09-12 08:40:58 +01:00
rstoyanchev d86bf8b205 Align RouterFunctions resource handling
Closes: gh-33434
2024-09-12 08:33:37 +01:00
Juergen Hoeller e9e5fee149 Consistently resolve exceptions for resources and handler functions
Closes gh-33381
2024-09-11 15:51:01 +02:00
Brian Clozel 2b9b581024 Add streaming support to MVC functional endpoints
Prior to this commit, MVC function endpoints would allow Server Sent
Event responses through `ServerResponse.sse()`. While this covers a
common use case for streaming responses, other technologies would
benefit from a "low-level", unopinionated streaming support.

This commit introduces a new `BodyBuilder.stream()` methods that enables
such use cases. Developers are in charge of setting the relevant HTTP
response headers beforehand, and then can write to the response as raw
`String`, `byte[]` or using complex objects and the configured message
converters for serialization.

Because each streaming protocol has different message separator
semantics, it is also the developers' responsibility to flush buffered
content to the network once a message has been fully written.

Closes gh-32710
2024-09-10 15:41:21 +02:00
rstoyanchev 88ff5e1dcc Remove unused imports 2024-09-10 13:36:16 +01:00
rstoyanchev ebef599146 Fix checkstyle violations 2024-09-10 13:05:57 +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 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
Brian Clozel 761fb8f6c9 Allow multiple listeners on ResponseBodyEmitter
Prior to this commit, `ResponseBodyEmitter` woud accept a single
`Runnable` callback on each of its `onTimeout`, `onError` or
`onCompletion` methods. This would limit the developers' ability to
register multiple sets of callbacks: one for managing the publication of
streaming values, another one for managing other concerns like
keep-alive signals to maintain the connection.

This commit now allows multiple calls to `onTimeout`, `onError` and
`onCompletion` and will register all callbacks accordingly.

Closes gh-33356
2024-09-06 15:30:18 +02:00
Sam Brannen 717b972f88 Polish contribution
See gh-33452
2024-09-03 18:08:23 +02:00
Yanming Zhou 019c0b1d4e
Expand acronyms FQN and FQCN
Closes gh-33452
2024-09-03 17:30:27 +02:00
Juergen Hoeller 69d5587f53 Merge branch '6.1.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java
2024-08-31 12:04:29 +02:00
Juergen Hoeller 1f6ab1a0c9 Polishing 2024-08-31 12:00:41 +02:00
Juergen Hoeller ce5869eeb0 Consistent test execution with Locale.UK 2024-08-31 12:00:34 +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
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
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
rstoyanchev 0d64c90a79 Move status/header handling into FragmentsRendering
Based on feedback from htmx-spring-boot. It's more generally useful
to process those from within DefaultFragmentsRendering rather than
in ModelAndViewMethodReturnValueHandler. That way a custom
return value handler can create a FragmentsRendering as well and
get the same result.

See gh-33194
2024-08-09 18:01:15 +03:00
rstoyanchev 8e2b27e5d8 WebFlux support for SSE with multiline fragments
See gh-33194
2024-08-08 16:25:03 +03:00
rstoyanchev 622c1b9e8c WebMvc support for SSE Fragment stream
Closes gh-33194
2024-08-05 14:38:23 +03:00
rstoyanchev 184bb7c23c Polishing in ResponseBodyEmitterReturnValueHandler
See gh-33194
2024-08-05 14:38:23 +03:00
Stéphane Nicoll 3aec39973c Polish 2024-08-02 09:16:15 +02:00
rstoyanchev dbc69284c8 ResponseEntityExceptionHandler handles AsyncRequestNotUsableException
Closes gh-33225
2024-07-30 11:33:47 +03:00
rstoyanchev 5ac7e74bf2 Replace test FilterRegistration with the one in testFixtures
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
rstoyanchev aa6b47bfce Polishing in FragmentsRendering
See gh-33194
2024-07-24 15:34:13 +01:00
Stéphane Nicoll d5abc071f1 Polish "Add missing Javadoc since in AbstractUrlHandlerMapping"
See gh-33247
2024-07-21 09:30:06 +02:00
Johnny Lim edc356d5a0 Add missing Javadoc since in AbstractUrlHandlerMapping
See gh-33247
2024-07-21 09:29:53 +02:00
Stéphane Nicoll e4edd3246a Restore Freemarker support now it supports Jakarta
Closes gh-30186
2024-07-18 17:55:52 +02:00
rstoyanchev bd31e8dacc Provide access to underlying ConstraintViolation
Closes gh-33025
2024-07-12 17:35:35 +01: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
rstoyanchev 65296c6aad Add status/headers to WebMVC FragmentsRendering
See gh-33162
2024-07-10 16:40:40 +01:00
rstoyanchev 14c1faa5ee Updates to WebMVC fragment rendering API
See gh-33162
2024-07-10 16:40:40 +01:00
Juergen Hoeller c6347025d6 Merge branch '6.1.x'
# Conflicts:
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
2024-07-08 19:54:07 +02:00
Juergen Hoeller 7227c30917 Allow tests to pass on Windows JVM (non-UTF-8 default encoding)
See gh-33071
2024-07-08 19:42:28 +02:00
rstoyanchev ef6a3768ee Support multi-view rendering
See gh-33162
2024-07-08 12:47:10 +01:00
rstoyanchev 545228d693 Remove unused tiles config files 2024-07-08 12:47:10 +01:00
Sam Brannen 932ce04541 Stop referring to old Spring versions in Javadoc 2024-07-01 17:50:52 +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
Sam Brannen b64edb2d2a Update Content-Type based on encoding in MVC FreeMarkerView
Closes gh-33119
2024-06-29 17:12:48 +02:00
Sam Brannen ce53443cf0 Polishing 2024-06-29 17:12:47 +02:00
Sam Brannen 8b95697c8d Set output_encoding in FreeMarkerView implementations
According to the official FreeMarker documentation, Spring's
FreeMarkerView implementations should be configuring the
output_encoding for template rendering.

To address that, this commit modifies the FreeMarkerView
implementations in Web MVC and WebFlux to explicitly set the
output_encoding for template rendering.

See https://freemarker.apache.org/docs/pgui_misc_charset.html#autoid_53
See gh-33071
Closes gh-33106
2024-06-27 10:07:47 +02:00
Sam Brannen 95887c81b9 Polish naming for Charset setters in FreeMarker support
See gh-33102
2024-06-26 17:51:11 +02:00
Sam Brannen 73c0783df1 Allow encoding to be set with a Charset in FreeMarker support
Closes gh-33102
2024-06-26 16:18:09 +02:00
rstoyanchev 4e13a69948 Fix spring-websocket test failure after 6c2f60
See gh-32813
2024-06-26 09:31:08 +01:00
Sam Brannen 7183a19dbe Merge branch '6.1.x' 2024-06-25 16:58:45 +02:00
Sam Brannen d133ab60ee Improve documentation regarding encoding in FreeMarker support
This commit also introduces integration tests to test the status quo
regarding encoding.

Closes gh-33071
2024-06-25 16:56:48 +02:00
rstoyanchev 6c2f602369 Propagate context to send for SSE Flux
Closes gh-32813
2024-06-25 15:39:43 +01:00
rstoyanchev c1250b1898 Replace use of deprecated ContextSnapshot methods
See gh-32813
2024-06-25 15:39:43 +01:00
Sam Brannen 5f765fc8ce Polishing 2024-06-23 13:22:08 +02:00
Sam Brannen e6b77d301d Merge branch '6.1.x' 2024-06-22 16:52:42 +02:00
Sam Brannen 000b563e83 Use consistent formatting for view name in AbstractView 2024-06-22 16:51:37 +02:00