Commit Graph

32657 Commits

Author SHA1 Message Date
Brian Clozel
c6b6ccdc89 Close ResponseBodyEmitter in case of write errors
Prior to this commit, the `ReactiveTypeHandler` would handle `Flux`-like
return types from controller methods and adapt them to SSE streams using
the `SseEmitter`/`ResponseBodyEmitter` APIs. In case an `IOException` is
thrown while writing to the HTTP response stream, the
`ReactiveTypeHandler` would rely on the Servlet container to call
`AsyncListener#onError` - this would be the signal for Spring MVC to
complete the async exchange. To prevent racing issues between this
signal and the actual handling of the exception, changes like  gh-20173
were applied. Since then, robust checks were added with gh-32340 in
`StandardServletAsyncWebRequest.LifecycleHttpServletResponse`.

With Jetty 12, `AsyncListener#onError` would not be called as the error
would happen while writing in blocking mode to the response (so, not
using the Servlet WriteListener contract). But still, such `IOException`
would still result in the closing of the HTTP connection. As of Jetty
12.0.4, this is no longer the case and the party managing the async
lifecycle is in charge of completing the exchange, as it should. This
means that the current behavior leaks HTTP connections for these cases
and causes memory issues.

This commit ensures that such exceptions happening during response
writes are caught and result in the completion of the `SSEEmitter` and
the closing of the exchange. Even if other Servlet containers still
propagate the error `AsyncListener#onError`, competing signals are still
managed with gh-32340.

Closes gh-32629
2024-05-13 20:30:13 +02:00
mysend12
3547491590 Handle DataBufferLimitException as HTTP 413 responses
Prior to this commit, `DataBufferLimitException` would be thrown by
codecs when the request body was too large for the configured buffer
limit. This exception would not be handled by the web infrastructure and
would result in an HTTP 500 server error.

This commit introduces a new `PayloadTooLargeException` type that will
result in an HTTP 413 "Payload too large" response status.

Closes gh-32558
2024-05-13 14:07:21 +02:00
Brian Clozel
80ec951fcf Merge branch '6.1.x' 2024-05-13 13:15:01 +02:00
Brian Clozel
09b8feadc2 Document streaming/collecting behavior for Flux return values
Closes gh-32630
2024-05-13 13:12:53 +02:00
rstoyanchev
10e3d3b434 Merge branch '6.1.x' 2024-05-13 11:41:22 +01:00
rstoyanchev
2c9ed4608f Improve RequestAttributesThreadLocalAccessor
Ensure access to request attributes after initial REQUEST dispatch
is done, and the RequestAttributes markedCompleted.

Closes gh-32296
2024-05-13 11:41:07 +01:00
rstoyanchev
3ada9a0c79 Polishing in tests of ThreadLocalAccessor implementations
See gh-32296
2024-05-13 11:41:07 +01:00
rstoyanchev
d03ea0bf19 Update docs on HandlerInterceptor
Closes gh-32729
2024-05-13 11:40:32 +01:00
rstoyanchev
a5a1ef6b30 Use instance field for ProblemDetail in ErrorResponse's
Closes gh-32644
2024-05-13 11:40:32 +01:00
rstoyanchev
1b60b86bb2 Update MockMvc section on Streaming in the docs
Closes gh-32687
2024-05-13 11:40:32 +01:00
Brian Clozel
5cb4985234 Merge branch '6.1.x' 2024-05-13 10:44:09 +02:00
Brian Clozel
89ce63f1f3 Replace RFC7807 by RFC9457 in documentation
This commit updates all references to RFC7807 by RFC9457 since the
former is now obsolete.

Closes gh-32806
2024-05-13 10:42:35 +02:00
Sam Brannen
19792f9670 Merge branch '6.1.x' 2024-05-12 12:32:20 +02:00
Sam Brannen
7536980be9 Fix Dokka links to Spring Framework and Servlet APIs
This commit fixes links from Spring Framework's Dokka HTML to Javadoc
for Spring Framework and Servlet APIs by explicitly configuring the
`element-list` page as the `package-list` in the Dokka Gradle plugin.

Closes gh-32797
2024-05-12 12:29:52 +02:00
Sam Brannen
f629fc9dc5 Polish Javadoc for SmartInstantiationAwareBeanPostProcessor 2024-05-11 16:13:26 +02:00
Sam Brannen
589b6dbba0 Merge branch '6.1.x' 2024-05-11 16:01:31 +02:00
Sam Brannen
c1229b03a7 Polishing 2024-05-11 16:01:08 +02:00
Juergen Hoeller
b3005fcdde Merge branch '6.1.x' 2024-05-10 13:53:04 +02:00
Juergen Hoeller
a4135bac5c Leniently ignore unsupported pointcut expression
See gh-32793
2024-05-10 13:52:39 +02:00
Juergen Hoeller
b2d43f54e0 Merge branch '6.1.x' 2024-05-10 12:29:49 +02:00
Juergen Hoeller
bf08e0c1b4 Polishing 2024-05-10 12:27:29 +02:00
Juergen Hoeller
9202c0ad41 Accept ajc-compiled @Aspect classes for Spring AOP proxy usage
Closes gh-32793
2024-05-10 12:27:12 +02:00
earlgrey02
797f586f9a Polish RouterFunctionDsl
Place the lambda outside the method call.

Closes gh-32765
2024-05-10 12:15:22 +02:00
Sébastien Deleuze
8ac39d0062 Polishing 2024-05-10 11:57:42 +02:00
Sébastien Deleuze
7985ab33f4 Throw an exception for suspending factory methods
Suspending factory methods are not supported, and can
have side effects, so it is better to fail explicitly
for such use case.

Closes gh-32719
2024-05-10 11:56:50 +02:00
Yanming Zhou
a02861f7db Insist on using CollectionUtils.isEmpty() and StringUtils.hasLength()
search `(\w+) != null && !(\1).isEmpty\(\)`
2024-05-09 09:25:09 +02:00
Yanming Zhou
8137cc9566 Polishing 2024-05-08 18:20:13 +02:00
Juergen Hoeller
7b16988ec9 Merge branch '6.1.x' 2024-05-08 17:52:42 +02:00
Juergen Hoeller
22b6d66a28 Document @Order behavior on @Configuration classes versus @Bean methods
Includes brief note on self injection (extracted from qualifiers section).

Closes gh-30177
Closes gh-28299
2024-05-08 17:52:02 +02:00
Juergen Hoeller
9376e6322d Revise IoC container introduction for modern configuration styles
Includes @Configuration(proxyBeanMethods=false) documentation.

Closes gh-32429
2024-05-08 17:51:25 +02:00
Juergen Hoeller
0eb937a866 Document limitations of CGLIB proxy class generation in JPMS module setups
Includes extended exception messages with common hints and explanations.

Closes gh-32671
2024-05-08 17:51:17 +02:00
Stéphane Nicoll
8d90817ba3 Polish and fix build failure 2024-05-08 15:59:28 +02:00
Stéphane Nicoll
36295e664a Merge branch '6.1.x' 2024-05-08 15:47:10 +02:00
Stéphane Nicoll
6250b64766 Add support for form data in MockHttpServletRequestBuilder
Closes gh-32757
2024-05-08 11:56:16 +02:00
Sam Brannen
3ce79c3fbf Polishing 2024-05-08 11:54:55 +03:00
Chad Attermann
cb48077698 Adds support for qualifying columns with table.
Adds support common in other ResultSet implemenatations for qualifying column names with table name to distinguish potentially duplicate column names in a join of two or more tables from one another. The expected format is {table_name}.{column_namne}, where column_name is the actuall designated column name and not the column label.
2024-05-08 10:35:55 +02:00
Stéphane Nicoll
2d942a6e91 Merge branch '6.1.x' 2024-05-08 10:30:19 +02:00
Stéphane Nicoll
5b1278d03c Refine exception message to include bean name
Closes gh-32775
2024-05-08 10:27:34 +02:00
Stéphane Nicoll
168276aaab Review AssertJ support for MockMvc
Closes gh-32712
2024-05-07 16:30:44 +02:00
Stéphane Nicoll
bcecce7aac Add shortcuts for frequently used assertions
See gh-32712
2024-05-07 16:28:44 +02:00
Stéphane Nicoll
c8967de065 Provide better name for entry points
This commit renames AssertableMockMvc to MockMvcTester as the former
was too mouthful, and we are looking for a naming pattern that can be
applied consistently to test utilities that rely on AssertJ.

Rather than AssertableMvcResult, we now use MvcTestResult and it no
longer extends from MvcResult itself. That avoids having existing code
that is migrated to the new API whilst assigning the result to MvcResult
and get a bad DevXP as that doesn't bring any of the AssertJ support.

See gh-32712
2024-05-07 16:28:44 +02:00
Stéphane Nicoll
5567d14700 Move response body directly in AbstractMockHttpServletResponseAssert
This commit removes ResponseBodyAssert and rather offers first-class
access support for the response body at the root level using bodyText(),
bodyJson(), and body().

This avoids a double navigation to assert the response body.

See gh-32712
2024-05-07 16:28:44 +02:00
Stéphane Nicoll
24cc77655f Merge JSON assertions in a single Assert type
This commit merges the JSONCompare and JsonPath support in a single
assert object. The rationale for the previous situation was that
JsonPath is optional but merging the assertions methods do not make
it mandatory as the usage if JsonPath is triggered only if it is
actually used.

See gh-32712
2024-05-07 16:28:44 +02:00
Juergen Hoeller
645556a28c Merge branch '6.1.x' 2024-05-07 15:53:00 +02:00
Juergen Hoeller
4f02be263f Polishing 2024-05-07 15:52:13 +02:00
Sam Brannen
ac0136b75c Clarify supported targets for annotations in the TestContext framework
Closes gh-32772
2024-05-07 16:45:12 +03:00
Juergen Hoeller
3048cfe9d9 Polishing 2024-05-06 20:16:07 +02:00
Juergen Hoeller
d9ca263065 Merge branch '6.1.x' 2024-05-06 20:11:56 +02:00
Juergen Hoeller
05d9b52b19 Polishing 2024-05-06 20:10:40 +02:00
Juergen Hoeller
59a125d06f Unwrap raw target Query instance in case of proxy mismatch
Closes gh-32766
2024-05-06 20:09:43 +02:00