Commit Graph

1486 Commits

Author SHA1 Message Date
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
Rossen Stoyanchev
a9d2016007 Merge branch '5.3.x' into main 2021-12-03 09:27:11 +00:00
Rossen Stoyanchev
5649a6f8ef Update exchangeToMono Javadoc
This time showing a more representative example.

See gh-27645
2021-12-03 09:21:21 +00:00
Arjen Poutsma
be6eeafe78 Revert change createException to createError
createError is not available in 5.3.

See gh-27645
2021-12-02 15:59:51 +01:00
Arjen Poutsma
720c30ce84 Merge branch '5.3.x' 2021-12-02 15:12:01 +01:00
Arjen Poutsma
b77b45434f Change createException to createError
See gh-27645
2021-12-02 15:11:15 +01:00
Rossen Stoyanchev
2d2db530b1 Merge branch '5.3.x' into main 2021-12-02 12:35:48 +00:00
Rossen Stoyanchev
8b89128c7b Update createException example for WebClient
Closes gh-27645
2021-12-02 11:53:43 +00:00
Arjen Poutsma
7794606305 Add ClientResponse::createError
This commit introduces ClientResponse::createError, returning
a Mono that terminates with a WebClientException.

Closes gh-27637
2021-12-01 11:10:10 +01:00
Arjen Poutsma
7a4207cd7b Changes because HttpMethod changed to class
This commit contains changes made because HttpMethod changed from enum
to class.

See gh-27697
2021-11-30 13:44:36 +01:00
Arjen Poutsma
f57004db2c Merge branch '5.3.x' 2021-11-30 13:41:19 +01:00
Arjen Poutsma
2a5713f389 Always copy ServerResponse headers
Prior to this commit, ServerResponse headers would only be written if
there were no existing headers with the same name, thus making it
impossible to overwrite existing headers.

With the changes in this commit, headers are always written.

Closes gh-27741
2021-11-30 13:38:16 +01:00
Arjen Poutsma
259bcd60fb Change deprecated MimeType specificity usages
This commit changes all code that uses now deprecated methods in
MimeType and MediaType.

See gh-27580
2021-11-23 11:49:01 +01:00
Rossen Stoyanchev
1694691b79 Default to JDK HttpClient if no others present
Closes gh-23432
2021-11-22 12:20:30 +00:00
Rossen Stoyanchev
fe8d42ff59 Add JdkHttpClientResourceFactory
See gh-23432
2021-11-22 12:20:30 +00:00