Commit Graph

1700 Commits

Author SHA1 Message Date
Sam Brannen 911d1f2dea Suppress warnings 2022-09-14 15:27:11 +02:00
Arjen Poutsma 71f9a84d22 Fix releasing bug in StringDecoder
This commit fixes an issue in StringDecoder, where, if the buffer did
not contain any delimiters, it was released before it was relayed to
any subscribers.

Closes gh-29119
2022-09-13 15:46:24 +02:00
Sébastien Deleuze 2687de0fe8 Add HandshakeWebSocketService runtime hints
Closes gh-29146
2022-09-13 15:37:06 +02:00
Brian Clozel bfac042301 Polish
See gh-28341
2022-09-12 18:02:56 +02:00
Brian Clozel ac9360b624 Instrument WebClient for Observability
This commit introduces Micrometer as an API dependency to the
spring-webflux module. Micrometer is used here to instrument `WebClient`
and record `Observation` for HTTP client exchanges.

This replaces Spring Boot's `MetricsWebClientFilterFunction` which
instruments `WebClient` via an `ExchangeFilterFunction`. Here, a direct
instrumentation is more efficient and less prone to metrics errors.

See gh-28341
2022-09-12 11:37:47 +02:00
rstoyanchev 3c5888c43f Polishing
See gh-28847
2022-09-12 09:37:11 +01:00
rstoyanchev 2f4c39ba2a Add classpath detection for Reactor Netty 2
See gh-28847
2022-09-12 09:37:11 +01:00
Brian Clozel 2b5ca63339 Fix serialization compiler warnings with Java 18
As of Java 18, the serial lint warning in javac has been expanded to
check for class fields that are not marked as `Serializable`.
See https://www.oracle.com/java/technologies/javase/18all-relnotes.html#JDK-8202056

In the Spring Framework codebase, this can happen with `Map`, `Set` or
`List` attributes which are often assigned with an unmodifiable
implementation variant. Such implementations are `Serializable` but
cannot be used as field types.

This commit ensures that the following changes are applied:
* fields are marked as transient if they can't be serialized
* classes are marked as `Serializable` if this was missing
* `@SuppressWarnings("serial")` is applied where relevant
2022-09-09 20:24:26 +02:00
rstoyanchev d373435856 Support for WebFlux on Reactor Netty 2 with Netty 5
See gh-28847
2022-09-08 21:54:46 +01:00
Sam Brannen 0395fb4f5f Polish tests 2022-09-07 15:12:15 +02:00
Sam Brannen 1688becd73 Avoid questionable use of ClassPathResource#getPath() in tests
Prior to this commit, several tests used ClassPathResource#getPath()
based on the knowledge that the ClassPathResource had been created
using the ClassPathResource(String,Class) constructor. However, making
such an assumption seems ill advised in light of the abstraction that
ClassPathResource provides.

In light of that, this commit avoids questionable use of
ClassPathResource#getPath() in tests by refactoring those tests to use
the proper abstractions provided by ClassPathResource.
2022-09-07 14:59:05 +02:00
Sébastien Deleuze 9cfe79186d Stop using RuntimeHintsUtils
Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29059
2022-09-07 10:10:07 +02:00
Sébastien Deleuze b8c1fc9202 Revert "Remove RuntimeHintsUtils"
This reverts commit 3e327f5641.
2022-09-06 18:21:34 +02:00
Sébastien Deleuze 3e327f5641 Remove RuntimeHintsUtils
Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29058
Closes gh-29059
2022-09-06 15:31:02 +02:00
Johnny Lim 706c1ec8dd Polish 2022-08-31 23:59:51 +09:00
Brian Clozel f877f81ae4 Move Netty 5 dependency to Framework platform 2022-08-30 21:58:41 +02:00
Andy Wilkinson a5fb55fd6d Replace dependency management plugin with built-in platform support 2022-08-30 17:03:24 +01:00
Arjen Poutsma 8a7e839ad0 Polishing 2022-08-30 15:22:26 +02:00
Arjen Poutsma 4b18cc94ea Merge branch '5.3.x' 2022-08-30 15:15:57 +02:00
Arjen Poutsma f91943977c RenderingResponse must set status code on RedirectView
This commit makes sure that WebFlux's RenderingResponse sets the HTTP
status code when rendering a RedirectView.

Closes: gh-28839
2022-08-30 15:14:03 +02:00
Sam Brannen b50415062b Clean up warnings and polish tests
This commit also modifies ResourceWebHandlerTests.getResourceFromFileSystem()
so that it passes in the IDE.
2022-08-26 15:20:16 +02:00
Arjen Poutsma 9c33d2707a Introduce support for Netty 5 Buffer
This commit introduces support for Netty 5's Buffer, in the form of
Netty5DataBuffer. Because of the new API offered by Buffer, several
changes have been made to the DataBuffer API:

- CloseableDataBuffer is a simpler alternative to PooledDataBuffer, and
  implemented by Netty5DataBuffer. DataBufferUtils::release can now
  handle CloseableDataBuffer as well as PooledDataBuffer.
- PooledDataBuffer::touch has been moved into a separate interface:
  TouchableDataBuffer, which is implemented by Netty5DataBuffer.
- The capacity of DataBuffers can no longer be reduced, they can only
  grow larger. As a consequence, DataBuffer::capacity(int) has been
  deprecated, but ensureWritable (formally ensureCapacity) still exists.
- DataBuffer::slice and retainedSlice have been deprecated in favor of
  split, a new method that ensures that memory regions do not overlap.
- DataBuffer::asByteBuffer has been deprecated in favor of toByteBuffer,
  a new method that returns a copy, instead of shared data.
- DataBufferFactory::allocateBuffer has been deprecated in favor of
  allocateBuffer(int).

Closes gh-28874
2022-08-25 11:00:22 +02:00
Stephane Nicoll cd2b7afc87 Avoid reflection on OptionalValidatorFactoryBean
Closes gh-28939
2022-08-08 16:53:53 +02:00
Rossen Stoyanchev 1aa4e7c68d Merge branch '5.3.x' 2022-07-29 16:20:51 +03:00
Rossen Stoyanchev 2172b99fee Polishing contribution
Closes gh-28836
2022-07-29 15:24:17 +03:00
floriankirmaier b6144e5682 Improve setting of WebSocket error status
See gh-28836
2022-07-29 15:07:15 +03:00
Arjen Poutsma 619f0e4266 Merge branch '5.3.x' 2022-07-28 14:24:25 +02:00
Arjen Poutsma b8b54ee524 Ensure WebClient exceptions are serializable
Not all HttpHeaders implementations are serializable. This commit
ensures that WebClientRequestException and WebClientResponseException
are serializable, by copying any non-serializable HttpHeaders into a
new, serializable, instance.

Closes gh-28321
2022-07-28 14:09:11 +02:00
Arjen Poutsma 97ea8a6789 Copy HttpHeaders to ensure serializability
Not all HttpHeaders implementations are serializable. This commit
ensures that WebClientRequestException and WebClientResponseException
are serializable, by copying any non-serializable HttpHeaders into a
new, serializable, instance.

Closes gh-28321
2022-07-28 13:55:43 +02:00
Arjen Poutsma db43425bf9 Javadoc 2022-07-14 15:24:47 +02:00
Arjen Poutsma f145b53fc8 Use existing context path in DefaultServerRequestBuilder
Closes gh-28820
2022-07-14 15:24:44 +02:00
Arjen Poutsma 1e03b30d33 Use existing context path in DefaultServerRequestBuilder
Closes gh-28820
2022-07-14 15:10:31 +02:00
Sam Brannen 0fb9de5d0e Merge branch '5.3.x' 2022-07-13 16:36:01 +02:00
Marc Wrobel bd3499671c Fix typos in test code
This commit fixes typos in test class names, test method names, and
test variable names.

Closes gh-28807
2022-07-13 16:24:11 +02:00
rstoyanchev 3badc47647 Polishing 2022-07-13 13:12:16 +01:00
Sam Brannen d660f5f62f Fix Javadoc in ResponseEntityExceptionHandler 2022-07-13 12:22:03 +02:00
rstoyanchev 263811ecfa Add WebFlux equivalent of ResponseEntityExceptionHandler
Closes gh-28665
2022-07-13 10:58:48 +01:00
rstoyanchev 380aedb12a Add ProblemDetailJacksonMixin
Closes gh-28665
2022-07-12 13:04:58 +01:00
Sam Brannen 983c6e233f Merge branch '5.3.x'
# Conflicts:
#	spring-webflux/src/main/java/org/springframework/web/reactive/result/view/RedirectView.java
2022-07-12 12:01:27 +02:00
Sam Brannen 19704805fd Polish contribution
See gh-28790
2022-07-12 11:56:01 +02:00
Marc Wrobel 31c6965c7f Fix and improve Javadoc in spring-webflux
Closes gh-28790
2022-07-12 11:48:58 +02:00
rstoyanchev 0938909cd9 Switch to Reactor 2022.0.0 snapshots
See gh-28766
2022-07-06 11:58:28 +01:00
Sam Brannen b61ac6315a Merge branch '5.3.x'
# Conflicts:
#	spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
2022-07-05 13:27:09 +02:00
Sam Brannen 0621a8eff1 Fix concurrency issues in FreeMarkerMacroTests
Prior to this commit, tests in these two classes intermittently failed
with errors similar to the following, due to concurrent modification
of shared files.

expected:
  "<input type="text" id="name" name="name" value="Darren"     >"
 but was:
  "<input type="text" id="name" name="name" value="Darren"     >

  "hidden"/>"

This commit fixes this by creating a new temporary folder for each test
method invocation.
2022-07-05 13:17:50 +02:00
rstoyanchev a575590c01 Merge branch '5.3.x' 2022-07-01 09:42:18 +01:00
rstoyanchev 058ce36402 Improve ExtendedWebExchangeDataBinder implementation
Close gh-28646
2022-07-01 03:23:32 +01:00
Vikey Chen 2afe560e41 Replace forEach with putAll
See gh-28646
2022-07-01 03:01:12 +01:00
Sébastien Deleuze 4ec3e1042a Add runtime hints for WebFlux
Closes gh-28701
2022-06-30 10:02:34 +02:00
rstoyanchev b312eca391 Deprecate and set trailingSlash option to false
Closes gh-28552
2022-06-29 16:09:10 +01:00
rstoyanchev 24c46142c6 Add docs on exceptions for HTTP interface client
Closes gh-28533
2022-06-24 15:55:18 +01:00
rstoyanchev a04e805d27 Expose status handler at WebClient.Builder level
See gh-28533
2022-06-24 13:58:57 +01:00
rstoyanchev 4ed581cdd7 Fix build failures 2022-06-24 13:58:57 +01:00
rstoyanchev b72ee5f034 Add static factory methods to WebClientAdapter
Ideally one would pass WebClient directly to HttpServiceProxyFactory,
but two need to remain decoupled. This commit adds static, shortcut
methods to WebClientAdapter to create an HttpServiceProxyFactory, thus
eliminating the step to wrap the WebClient.
2022-06-24 09:55:21 +01:00
rstoyanchev 45ee7913bf Polishing ProblemDetail support
See gh-28665
2022-06-24 09:55:21 +01:00
Brian Clozel 0783f0762d Improve conditional requests support
Prior to this commit, Spring MVC and Spring WebFlux would not support
conditional requests with `If-Match` preconditions. As underlined in the
RFC9110 Section 13.1, those are related to the `If-None-Match`
conditions, but this time only performing requests if the resource
matches the given ETag.

This feature, and in general the `"*"` request Etag, are generally
useful to prevent "lost updates" when performing a POST/PUT request: we
want to ensure that we're updating a version with a known version or
create a new resource only if it doesn't exist already.

This commit adds `If-Match` conditional requests support and ensures
that both `If-Match` and `If-None-Match` work well with `"*"` request
ETags.

We can't rely on `checkNotModified(null)`, as the compiler can't decide
between method variants accepting an ETag `String` or a Last Modified
`long`. Instead, developers should use empty ETags `""` to signal that
no resource is known on the server side.

Closes gh-24881
2022-06-21 19:29:20 +02:00
Sam Brannen 04dde03451 Merge branch '5.3.x' 2022-06-20 16:03:09 +02:00
Sam Brannen e19e9757d4 Polishing 2022-06-20 15:19:02 +02:00
rstoyanchev 933965b7b4 Merge branch '5.3.x' 2022-06-14 12:20:34 +01:00
rstoyanchev 52d0681ca1 WebMvc respects RouterFunction beans ordering
Closes gh-28595
2022-06-14 09:20:19 +01:00
Arjen Poutsma 216a266856 Polish 2022-06-08 17:00:58 +02:00
christophejan bbabf8d855 Add minimal Kotlin DSL RouterFunction attributes support
Closes gh-28567
2022-06-08 16:49:46 +02:00
christophejan 5b1bda5c7c Add test case on nested RouterFunction attributes 2022-06-08 16:49:46 +02:00
Sam Brannen df45c80bfe Merge branch '5.3.x' 2022-06-01 16:30:44 +02:00
Sam Brannen cda1e5507c Polishing 2022-06-01 16:28:05 +02:00
Balázs Póka 1d5ffaf30a Always construct new exception on error in DefaultWebClient
Always construct new exception on error, otherwise memory leak may
occur due to repeated use of singleton exception.

Closes gh-28550
2022-06-01 16:07:41 +02:00
rstoyanchev ff890bc1cc Support custom HTTP method for @HttpExchange
Closes gh-28504
2022-05-24 09:27:35 +01:00
rstoyanchev 48c1746693 Refactor HttpServiceProxyFactory for use as a bean
Closes gh-28505
2022-05-24 09:27:17 +01:00
rstoyanchev 496c1dcae1 Add RequestAttributeArgumentResolver
Closes gh-28458
2022-05-23 11:06:14 +01:00
rstoyanchev f0e23b66f3 The "consumes" condition compares MediaType parameters
Closes gh-9257
2022-05-11 17:52:04 +01:00
Sam Brannen eb50a6f4a0 Further polishing regarding JDK baseline upgrade
See gh-28440
2022-05-10 17:01:40 +02:00
Arjen Poutsma 5c5c89e9fe Merge branch '5.3.x' 2022-05-10 15:55:54 +02:00
Arjen Poutsma e4ec376075 Disabling Undertow server in CoroutinesIntegrationTests 2022-05-10 15:55:00 +02:00
Sam Brannen d44ba0a42b Consistent formatting 2022-05-10 13:12:11 +02:00
rstoyanchev 922636e85e Content decoding in client exceptions
Closes gh-28190
2022-05-10 11:48:46 +01:00
rstoyanchev 6b1a8452fa Polishing 2022-05-10 11:48:46 +01:00
Sam Brannen d45b5f6e8a Merge branch '5.3.x'
# Conflicts:
#	spring-webflux/src/main/java/org/springframework/web/reactive/resource/VersionResourceResolver.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java
2022-05-10 11:44:14 +02:00
Sam Brannen 1c10cdd1e8 Update copyright dates
See gh-28433
2022-05-10 11:33:32 +02:00
evgeny.bovykin 941b92cbed Make inner classes static when feasible
A static nested class does not keep an implicit reference to its
enclosing instance.

This prevents a common cause of memory leaks and uses less memory per
instance of the class.

Closes gh-28433
2022-05-10 11:32:37 +02:00
rstoyanchev 8378af9e39 Polishing
See gh-28189
2022-05-09 19:01:10 +01:00
rstoyanchev 78ab4d7118 Support content negotiation for RFC 7807
Closes gh-28189
2022-05-09 18:32:21 +01:00
Sam Brannen 6c131ef9dc Merge branch '5.3.x' 2022-05-09 15:23:15 +02:00
Sam Brannen a1c7380398 Add test for `value` attribute in @ModelAttribute in WebFlux
This complements the previous commit which tested only the `name`
attribute.

See gh-28423
2022-05-09 15:22:22 +02:00
rstoyanchev 5d0f49c2c8 Add WebInputException subclasses
Closes gh-28142
2022-05-09 09:52:15 +01:00
Sam Brannen 061d1263f8 Merge branch '5.3.x' 2022-05-07 17:24:50 +02:00
Sam Brannen 7dd622bdb2 Support name attribute in @ModelAttribute in WebFlux
Prior to this commit, the `name` attribute in @ModelAttribute was not
supported when using WebFlux. This is because MethodParameter was used
instead of SynthesizingMethodParameter when retrieving the
@ModelAttribute annotation. In other words, @AliasFor was not honored
because the annotation was not synthesized. Consequently, only the
`value` attribute was supported in WebFlux when specifying a custom name
via @ModelAttribute.

This commit fixes this by using SynthesizingMethodParameter to retrieve
the @ModelAttribute annotation.

Closes gh-28423
2022-05-07 17:16:26 +02:00
Sam Brannen 9b1c8a3a5c Fix broken ToStringVisitorTests
Tests were broken due to the switch to Set.of(...) in
2b65f274dc.
2022-05-07 16:45:46 +02:00
Sam Brannen a69d9716c9 Merge branch '5.3.x' 2022-05-07 16:28:01 +02:00
Sam Brannen 64c96c579d Polish contribution
See gh-28422
2022-05-07 16:18:47 +02:00
Carlos Bouzón García 39e3876301 Fix BindingResult error when ModelAttribute has custom name in WebFlux
Closes gh-28422
2022-05-07 16:18:04 +02:00
Juergen Hoeller 2b65f274dc Use Set.of instead of HashSet with Arrays.asList 2022-05-06 16:19:27 +02:00
rstoyanchev b4e6014a14 Merge branch '5.3.x' into main 2022-04-28 11:40:11 +01:00
rstoyanchev b30f4d7bb7 Exposes all root causes to ExceptionHandler methods
Closes gh-28155
2022-04-28 04:04:57 +01:00
rstoyanchev b1384ddafa Add HttpServiceProxyFactory builder
See gh-28386
2022-04-27 21:21:43 +01:00
rstoyanchev d7ab5b4132 Refactor HttpRequestSpec to HttpRequestValues
HttpRequestValues is immutable and exposes a builder.

See gh-28386
2022-04-27 21:21:43 +01:00
rstoyanchev 564f8ba7a0 Update after review
See gh-28386
2022-04-27 21:21:43 +01:00
rstoyanchev c418768f05 Add @HttpRequest and HttpServiceProxyFactory
See gh-28386
2022-04-27 21:21:43 +01:00
Arjen Poutsma be7fa3aaa8 Introduce PartEvent
This commit introduces the PartEvent API. PartEvents are either
- FormPartEvents, representing a form field, or
- FilePartEvents, representing a file upload.

The PartEventHttpMessageReader is a HttpMessageReader that splits
multipart data into a stream of PartEvents. Form fields generate one
FormPartEvent; file uploads produce at least one FilePartEvent. The last
element that makes up a particular part will have isLast set to true.

The PartEventHttpMessageWriter is a HttpMessageWriter that writes a
Publisher<PartEvent> to a outgoing HTTP message. This writer is
particularly useful for relaying a multipart request on the server.

Closes gh-28006
2022-04-20 11:00:07 +02:00
Sam Brannen 081c6463e9 Polish Javadoc for PathVariableMapMethodArgumentResolver 2022-04-16 17:57:44 +02:00
Sam Brannen 1574fed90b Merge branch '5.3.x' 2022-04-13 10:08:31 +02:00
Sam Brannen a7cf19cec5 Improve documentation and matching algorithm in data binders 2022-04-13 09:55:40 +02:00
Arjen Poutsma 9adfa5e8b0 Add HEAD support in MVC/WebFlux Resource handling
This commit introduces explicit HEAD support in Spring
MVC's ResourceHttpRequestHandler and WebFlux's ResourceWebHandler,
adding just headers but no body.

Closes gh-28291
2022-04-07 13:51:21 +02:00
Arjen Poutsma 192f2becf6 Automatically clean up multipart temp files
This commit ensures that any resources created for multipart handling,
obtained via ServerWebExchange.getMultipartData(), are automatically
deleted after handling the completing the response.

Resource for parts obtained via BodyExtractors::toMultipartData and
BodyExtractors::toParts are not cleaned automatically, and
should be cleaned via Part::delete.

Closes gh-27633
2022-04-06 17:02:31 +02:00
rstoyanchev aea39fdad3 Merge branch '5.3.x' into main 2022-04-01 17:57:48 +01:00
rstoyanchev 24cd3c1f4c Revert "Disable flaky integration tests for now"
This reverts commit 1627f57f1f in
preparation for fixing the root cause
2022-04-01 16:07:05 +01:00
Stephane Nicoll 9ea741364a Merge branch '5.3.x' 2022-03-31 09:47:29 +02:00
Stephane Nicoll 1627f57f1f Disable flaky integration tests for now 2022-03-31 09:46:36 +02:00
Sam Brannen 7a1421cb0f Suppress deprecation warnings in tests 2022-03-29 15:04:58 +02:00
Arjen Poutsma 28ac0d3883 Use HttpStatusCode interface
This commit contains changes made because of the introduction of
HttpStatusCode. In general, methods that used to return a HttpStatus
now return HttpStatusCode instead, and methods that returned raw status
codes are now deprecated.

See gh-28214
2022-03-23 12:49:38 +01:00
Sam Brannen 9764f0e59b Merge branch '5.3.x'
# Conflicts:
#	spring-test/src/test/java/org/springframework/mock/http/server/reactive/MockServerHttpRequestTests.java
#	spring-web/src/test/java/org/springframework/http/server/reactive/HeadersAdaptersTests.java
#	spring-web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SseIntegrationTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/handler/MappedInterceptorTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HandlerMethodAnnotationDetectionTests.java
#	spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java
2022-03-16 15:07:53 +01:00
Sam Brannen c462fe30ed Use Named arguments in parameterized tests 2022-03-16 14:45:47 +01:00
Sam Brannen 8a0c4caff6 Polish Javadoc 2022-03-16 14:33:52 +01:00
Sam Brannen 4db2f8ea1b Remove obsolete Nashorn-based scripting tests
Since the Nashorn JavaScript engine was removed in Java 15, these tests
will never be run on a Java 17+ JDK which is required as of Spring
Framework 6.0.

See gh-27919
2022-03-15 16:33:52 +01:00
Arjen Poutsma 5abaf20a74 Merge branch '5.3.x' 2022-03-11 12:22:39 +01:00
Arjen Poutsma a3e23cd5fc Fix unwrapping logic for ResponseEntity<Flux>
This commit makes sure that the response returned by coroutine handler
methods that return ResponseEntity<Flux> is unwrapped correctly.

Closes gh-27809
2022-03-11 11:56:13 +01:00
rstoyanchev 76be6373a8 ErrorResponse support in Spring MVC exception hierarchy
All Spring MVC exceptions from spring-web, now implement ErrorResponse
and expose HTTP error response information, including an RFC 7807 body.

See gh-27052
2022-02-28 13:40:05 +00:00
rstoyanchev 3efedef161 Add ErrorResponse and ErrorResponseException
ErrorResponse represents a complete error response with status, headers,
and an  RFC 7807 ProblemDetail body.

ErrorResponseException implements ErrorResponse and is usable on its
own or as a base class. ResponseStatusException extends
ErrorResponseException and now also supports RFC 7807 and so does its
sub-hierarchy.

ErrorResponse can be returned from `@ExceptionHandler` methods and is
mapped to ResponseEntity.

See gh-27052
2022-02-28 13:40:05 +00:00
rstoyanchev 714d451260 Add ProblemDetail and `@ExceptionHandler` support
ProblemDetail is a representation of an RFC 7807 "problem", and this
commits adds support for it in Spring MVC and WebFlux as a return value
from `@ExceptionHandler` methods, optionally wrapped with
ResponseEntity for headers.

See gh-27052
2022-02-28 13:40:05 +00:00
Sam Brannen c42023f20e Stop using SocketUtils in WebClientIntegrationTests
See gh-28052
2022-02-15 14:59:26 +01:00
Sam Brannen 552e02cb44 Polishing 2022-02-15 14:44:46 +01:00
Sam Brannen 7412625929 Merge branch '5.3.x'
# Conflicts:
#	spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
2022-02-15 14:35:25 +01:00
Sam Brannen 685a195ba1 Deprecate SocketUtils
SocketUtils was introduced in Spring Framework 4.0, primarily to assist
in writing integration tests which start an external server on an
available random port. However, these utilities make no guarantee about
the subsequent availability of a given port and are therefore
unreliable. Instead of using SocketUtils to find an available local
port for a server, it is recommended that users rely on a server's
ability to start on a random port that it selects or is assigned by the
operating system. To interact with that server, the user should query
the server for the port it is currently using.

SocketUtils is now deprecated in 5.3.16 and will be removed in 6.0.

Closes gh-28052
2022-02-15 14:28:58 +01:00
Sébastien Deleuze 5e64081ed1 Merge branch '5.3.x' 2022-02-14 10:51:46 +01:00
Sébastien Deleuze 8eb618b480 Make Kotlin functions accessible in CoroutinesUtils
In order to allow using private classes like in Java
for example.

Closes gh-23840
2022-02-14 10:43:31 +01:00
Brian Clozel 6c42bcfaec Upgrade to Kotlin 1.6.20-M1
This commit upgrades the Kotlin dependencies to 1.6.20-M1 and configures
the build to generate Java 17 bytecode for Kotlin classes.

Closes gh-27814
2022-02-11 11:39:32 +01:00
Sam Brannen b3f786728e Use modern language features in tests 2022-02-03 15:35:32 +01:00
Sam Brannen 54565e95b5 Merge branch '5.3.x' 2022-02-03 14:58:36 +01:00
Sam Brannen f8a5a8d7be Use modern language features in tests 2022-02-03 14:50:10 +01:00
Arjen Poutsma a9a6b071d9 Merge branch '5.3.x' 2022-01-28 13:45:45 +01:00
Arjen Poutsma caa13690e8 Support multiple boundary buffers in MultipartParser
In a small minority of cases, the multipart boundary can spread across
three incoming buffers.

Prior to this commit, MultipartParser.BodyState only supported two
buffers. If the boundary is spread across three buffers, the first
buffer of the three is sent as a whole, even though it contains the
first bytes of the boundary.

This commit fixes this bug, by enqueuing all prior buffers in a queue,
and emitting the ones that cannot contain boundary bytes.

Closes gh-27939
2022-01-28 13:42:24 +01:00
Sam Brannen 316e84f04f Polish contribution
See gh-27908
2022-01-14 15:53:41 +01:00
Frank Chen f43fb41bce Simplify debugging of Undertow transferTo issue
This commit introduces a dedicated (disabled) transferToWithUndertow()
test method to simplify debugging of transferTo issues with Undertow.

See gh-25310
Closes gh-27908
2022-01-14 15:44:29 +01:00
Sam Brannen a849f76586 Merge branch '5.3.x' 2022-01-13 17:57:14 +01:00
Sam Brannen c92b9bc7fe Properly abort transferTo test for Undertow
Instead of simply returning prematurely and allowing the tests to be
marked as SUCCESS, this commit uses a failed assumption to abort the
the trasferTo tests for Undertow, resulting in the parameterized test
invocation properly being marked as ABORTED.

See gh-25310
2022-01-13 17:55:37 +01:00
rstoyanchev 7067461d71 Fix exception in Jetty10RequestUpgradeStrategy
Closes gh-27899
2022-01-12 15:04:05 +00:00
rstoyanchev d61d0d41a3 Merge branch '5.3.x' into main 2022-01-12 09:02:07 +00:00
rstoyanchev 7665424ea8 Polishing contribution
Closes gh-27888
2022-01-12 08:55:32 +00:00
Max Demydenko f63a106c85 clear() method also clears argument resolver cache
See gh-27888
2022-01-12 08:55:32 +00:00
Sam Brannen d57bc176f2 Merge branch '5.3.x' 2022-01-10 14:21:25 +01:00
Sam Brannen df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
Sébastien Deleuze a410f4c0f2 Upgrade Kotlin Coroutines to 1.6.0
Closes gh-27878
2022-01-03 15:45:37 +01:00
izeye 713795cc34 Polish
See gh-27827
2021-12-21 09:36:08 +01:00
Juergen Hoeller ba468a731f Remove JamonPerformanceMonitorInterceptor support
Includes upgrade to Tomcat 10.0.14, Undertow 2.2.14, Apache HttpClient 5.1.2, Hibernate ORM 5.6.2, Mockito 4.1.

Closes gh-27786
2021-12-14 09:46:08 +01:00
Rossen Stoyanchev 3600644ed1 Require type-level @Controller annotation
Closes gh-22154
2021-12-14 07:09:08 +00:00
Rossen Stoyanchev a15393836c Merge branch '5.3.x' into main 2021-12-09 15:35:21 +00:00
Rossen Stoyanchev e9083d7d20 Apply LogFormatUtils in more places 2021-12-09 14:53:52 +00:00
Juergen Hoeller 7f43128a0e Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-web/src/main/java/org/springframework/web/server/MediaTypeNotSupportedStatusException.java
#	spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerMappingIntrospector.java
2021-12-03 22:42:05 +01:00
Juergen Hoeller 70974e006e Upgrade to Tomcat 9.0.55, Undertow 2.2.13, RxJava 3.1.3, SmallRye Mutiny 1.2, Joda-Time 2.10.13, JRuby 9.2.20.1, HtmlUnit 2.55, Checkstyle 9.2 2021-12-03 22:32:00 +01:00
Arjen Poutsma 0a41da9ec9 Merge branch '5.3.x' 2021-12-03 12:52:30 +01:00
Arjen Poutsma b84fe99d07 Polish "Throw 404 ResponseStatusException when no routes found"
See gh-25358
2021-12-03 12:01:49 +01:00
Ingmar van Dijk 69df27a99f Throw 404 ResponseStatusException when no routes found
This commit makes it possible to customize 404 responses generated by
RouterFunctionWebHandler, by throwing an ResponseStatusException
instead of returning a standard 404 response.

See gh-25358
2021-12-03 12:01:49 +01:00