1. Rename globalResources to useGlobalResources.
2. Use of global resources is mutually exlusive with explicit config.
3. Allow Consumer<HttpResources> to configure global resources.
4. Allow ConnectionProvider + LoopResources Supplier to customize
creation and initialization.
5. Do not manage externally provided ConnectionProvider + LoopResources
instances.
Issue: SPR-17243
This commit adds decoder/message-reader tests for errors in
the source data buffer publisher. Because the tests extend
AbstractDataBufferAllocatingTestCase, they also check whether
the buffers that precede the error in the stream are properly
released.
Issue: SPR-17025
This commit optimizes Flux <-> Mono conversions in our codebase by
avoiding to hide that conversion from Reactor.
This tries to keep conversions sequentially so that they can be detected
by Reactor and optimized. In Spring WebFlux, this means keeping the
conversions at the edges of a method implementation (right when getting
an input parameter, and before returning it as a result). If those
conversions are made between other operators, Reactor might not be able
to detect those conversions and optimize them.
Issue: SPR-17203
Prior to this commit, an bug introduced in SPR-16949 prevented
`Mono.empty` bodies from being written to the response.
This commit ensures that empty bodies still trigger the writing to the
response and does not hang the processing of the exchange.
Issue: SPR-17220
This commit represents a best effort attempt at fixing remaining
"a" vs. "an" grammatical errors related links specified via a fully
qualified class name.
Issue: SPR-17208
When used as global Netty resources, ReactorResourceFactory creates and
sets those resources on Reactor's HttpResources directly.
When that ReactorResourceFactory bean is destroyed, those resources are
disposed but HttpResources still holds a reference to those and may try
to use them again.
This commit uses HttpResources to clear those resources and its
references to it, when the ReactorResourceFactory is treating those as
global.
Issue: SPR-17199
JettyResourceFactory, similar to ReactorResourceFactory, allows
to share resources (Executor, ByteBufferPool, Scheduler) between
Jetty clients and servers.
Issue: SPR-17179
Prior to this commit, when using the `SimpleClientHttpRequestFactory`
as a driver for `RestTemplate`, the HTTP response body would only be
drained if there was an attempt to read it in the first place.
This commit ensures that, even if there's no attempt at reading the
response body, it is properly drained when the response is closed to
make sure that the connection is released in a proper state and can be
put back in the connection pool for reuse.
Issue: SPR-17181
When dealing with `Optional` values in a Controller handler (for
example, values coming from a Spring Data repository), developers might
reuse this code snippet quite often:
```
@GetMapping("/user")
public ResponseEntity<Optional<User>> fetchUser() {
Optional<User> user = //...
return user.map(ResponseEntity::ok).orElse(notFound().build());
}
```
This commit adds a new static method on `ResponseEntity` for that,
simplifying the previous snippet with `return ResponseEntity.of(user);`
Note that in case more specific HTTP response headers are required by
the application, developers should use other static methods to
explicitly tell which headers should be used in each case.
Issue: SPR-17187
Rename "Builder" sub-section to "Configuration" and move it in the
beginning before all others since it explains how to create a client
in the first place.
Update content on Reactor Netty connector based on the API in 0.8 and
specifically address Reactor Netty resources and lifecycle.
Issue: SPR-16963
1. Update ExchangeFilterFunctions to delegate internally to
HttpHeaders.setBasicAuth(user, password).
2. Remove deprecation from
ExchangeFilterFunctions.basicAuthentication(String user, String password)
It is still useful as a filter to insert the header.
3. Update deprecation notes.
Issue: SPR-17099