Commit Graph

3842 Commits

Author SHA1 Message Date
rstoyanchev b045e5baef Tests for ErrorResponse hierarchy to verify the output
See gh-27052
2022-02-28 13:40:05 +00: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 8c6d59aaaf Polish contribution
See gh-28014
2022-02-19 14:43:26 +01:00
a.yazychyan c5c926726d Use enhanced switch expressions where feasible
Closes gh-28014
2022-02-19 14:34:05 +01:00
Phillip Webb b3306f4e3d Suppress deprecation warning in WebAsyncManagerTests
See gh-27959
2022-02-15 15:11:31 -08:00
Brian Clozel bfe9d4fc49 Merge branch '5.3.x' 2022-02-14 16:23:49 +01:00
Brian Clozel 88f73bffa0 Make assertion message lazy in ServletRequestPathUtils
Closes gh-27946
2022-02-14 16:21:41 +01:00
rstoyanchev 7ecfce2386 Polishing contribution
See gh-27948
2022-02-14 11:26:40 +00:00
heowc ad2722b3a3 MissingServletRequestPartException extends ServletRequestBindingException
Closes gh-27948
2022-02-14 11:26:40 +00:00
Juergen Hoeller 9688e61e20 Upgrade to Groovy 4.0
Closes gh-27985
2022-02-04 21:01:02 +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
rstoyanchev 823958bcc5 Merge branch '5.3.x' into main
Remove use of Mockito spy proxies, which don't work on Java 17.
2022-02-02 17:35:54 +00:00
rstoyanchev c4e362500b Polishing tests 2022-02-02 17:09:04 +00:00
rstoyanchev 8d5a6520ce Ensure all converters don't close InputStream
Closes gh-27969
2022-02-02 15:55:13 +00:00
rstoyanchev 4effca35b5 Ignore Content-Type that is invalid (not concrete)
Closes gh-27957
2022-02-02 15:55:07 +00:00
Sam Brannen de33e3b575 Merge branch '5.3.x' 2022-01-29 12:43:18 +01:00
Sam Brannen dbeae27d3c Reduce build time by reducing shutdown wait period for Jetty tests 2022-01-29 12:41:39 +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 786d80c0bb Merge branch '5.3.x' 2022-01-27 16:13:55 +01:00
Sam Brannen 6647023151 Document how to register annotated classes in a GenericWebApplicationContext
Closes gh-27778
2022-01-27 16:08:16 +01:00
Sam Brannen e32f94bf8c Polish GenericWebApplicationContext and AnnotationConfigWebApplicationContext 2022-01-27 16:08:07 +01:00
Sam Brannen 912bb16e44 Merge branch '5.3.x' 2022-01-20 15:54:50 +01:00
shirohoo 7211912057 Polish tests in spring-web
This PR polishes trivial things in tests in spring-web.

Closes gh-27958
2022-01-20 15:44:24 +01:00
Juergen Hoeller 50faa29329 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
2022-01-12 16:38:19 +01:00
Juergen Hoeller 6b3052200a Skip "data:" lines without content
Closes gh-27923
2022-01-12 16:35:42 +01:00
rstoyanchev d61d0d41a3 Merge branch '5.3.x' into main 2022-01-12 09:02:07 +00:00
rstoyanchev 34cb5df859 Consistent id for ReactorServerHttpRequest
Closes gh-27885
2022-01-12 08:55:32 +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
rstoyanchev caaf48d4ec Add missing overrides to ServerHttpResponseDecorator
Closes gh-27889
2022-01-12 08:55:32 +00:00
rstoyanchev 6643efe0b4 Merge branch '5.3.x' into main 2022-01-11 18:48:49 +00:00
rstoyanchev e8e7fbba94 Polishing contribution and fix failing test
The failing test is for Apache HttpComponents where we cannot apply the
Content-Length together with other headers, and must pass it instead
explicitly to ReactiveEntityProducer when writing at which point it gets
set in the native headers.

Closes gh-27768
2022-01-11 17:07:26 +00:00
sokomishalov bd1f34e174 Apply adapters to client request headers after committed
See gh-27768
2022-01-11 15:30:03 +00:00
Arjen Poutsma b848acd86d Merge branch '5.3.x' 2022-01-11 13:44:45 +01:00
Arjen Poutsma a490723f02 NettyHeadersAdapter::putAll does not overwrite headers
Similar to 4078b73cec, but for the
client-side NettyHeadersAdapter::putAll.

See gh-27887
2022-01-11 13:33:15 +01: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
Arjen Poutsma 1941ae6696 Merge branch '5.3.x' 2022-01-10 11:01:38 +01:00
Arjen Poutsma 4078b73cec NettyHeadersAdapter::putAll does not overwrite headers
NettyHeadersAdapter::putAll uses HttpHeaders::add, which does not
overwrite existing headers. putAll should use HttpHeaders::set instead,
just like NettyHeadersAdapter::put does.

Closes gh-27887
2022-01-10 10:54:04 +01:00
Sam Brannen 202b7ea47b Merge branch '5.3.x' 2022-01-04 15:17:05 +01:00
Sam Brannen c3ce4f0f90 Polish contribution
See gh-27823
2022-01-04 15:12:29 +01:00
Marten Deinum e1200f34e7 Use try-with-resources for AutoClosables where feasible
Where unfeasible, this commit adds inline comments to explain why
try-with-resources must not be used in certain scenarios. The purpose
of the comments is to avoid accidental conversion to try-with-resources
at a later date.

Closes gh-27823
2022-01-04 15:12:29 +01:00
Marten Deinum 948f5999c3 Replace use of StringBuffer with StringBuilder
With JDK 9, java.util.regex.Matcher received overloaded variants of
appendReplacement() and appendTail() that accept a StringBuilder,
allowing us to replace the use of StringBuffer with StringBuilder.

Closes gh-27822
2022-01-04 13:14:17 +01:00
Marten Deinum 941b6af9ac Use Collection factory methods when applicable
This commit replaces the use of Collections.unmodifiableList/Set/Map
with the corresponding 'of(...)' factory methods introduced in Java 9.

Closes gh-27824
2022-01-04 12:01:13 +01:00
Sam Brannen 6555d3b42d Suppress warnings in tests 2022-01-03 16:12:14 +01:00