Commit Graph

976 Commits

Author SHA1 Message Date
Sébastien Deleuze 0f41536820 Fix RSocketRequester Coroutines extensions
After gh-24073, some Coroutines extensions should be applied on
RetrieveSpec instead of RequestSpec.

Closes gh-24166
2019-12-09 11:50:06 +01:00
Sam Brannen 55ae3c5e87 Polishing 2019-12-07 12:59:03 +01:00
Brian Clozel d4209392d2 Allow ExchangeStrategies customizations in WebClient
Prior to this commit, developers could configure their WebClient to use
their custom `ExchangeStrategies`, by providing it in the
`WebClient.Builder` chain.
Once created, an `ExchangeStrategies` instance is not mutable, which
makes it hard for further customizations by other components. In the
case of the reported issue, other components would override the default
configuration for the codecs maxInMemorySize.

This commit makes the `ExchangeStrategies` mutable and uses that fact to
further customize them with a new `WebClient.Builder#exchangeStrategies`
`Consumer` variant. This commit is also deprecating those mutating
variants in favor of a new `WebClient.Builder#exchangeStrategies` that
takes a `ExchangeStrategies#Builder` directly and avoids mutation issues
altogether.

Closes gh-23961
2019-12-02 14:12:59 +00:00
Brian Clozel 1560bbd81e Revert "Allow ExchangeStrategies customizations in WebClient"
This reverts commit b3020bc484.
2019-12-02 10:39:53 +01:00
Juergen Hoeller 567c7695dd Polishing 2019-12-01 00:20:00 +01:00
Brian Clozel b3020bc484 Allow ExchangeStrategies customizations in WebClient
Prior to this commit, developers could configure their WebClient to use
their custom `ExchangeStrategies`, by providing it in the
`WebClient.Builder` chain.
Once created, an `ExchangeStrategies` instance is not mutable, which
makes it hard for further customizations by other components. In the
case of the reported issue, other components would override the default
configuration for the codecs maxInMemorySize.

This commit makes the `ExchangeStrategies` mutable and uses that fact to
further customize them with a new `WebClient.Builder#exchangeStrategies`
`Consumer` variant. This commit is also deprecating those mutating
variants in favor of a new `WebClient.Builder#exchangeStrategies` that
takes a `ExchangeStrategies#Builder` directly and avoids mutation issues
altogether.

Closes gh-23961
2019-11-29 22:26:52 +01:00
Rossen Stoyanchev 25f3465f1f Polishing contribution
See gh-24087
2019-11-29 15:53:37 +00:00
Parviz ROzikov e858b21c60 #24022 - added protobuf MessageConverter 2019-11-29 14:20:05 +00:00
Rossen Stoyanchev 26d800cc93 Fix empty payload handling in RSocketRequester
Closes gh-24088
2019-11-27 07:35:45 +00:00
Rossen Stoyanchev 30d68f2de7 Reject user names with "%2F" in STOMP
Closes gh-23836
2019-11-26 16:21:48 +00:00
Rossen Stoyanchev 6ed1b5835b Separate step for retrieve in RSocketRequester
Closes gh-24073
2019-11-25 11:47:41 +00:00
Sébastien Deleuze 712eac2915 Refine Coroutines annotated controller support
This commit refines Coroutines annotated controller support
by considering Kotlin Unit as Java void and using the right
ReactiveAdapter to support all use cases, including suspending
functions that return Flow (usual when using APIs like WebClient).

It also fixes RSocket fire and forget handling and adds related tests
for that use case.

Closes gh-24057
Closes gh-23866
2019-11-22 14:13:17 +01:00
Rossen Stoyanchev 996f7290cf Allow async metadata in RSocketRequester
This commit allows single-value async producers for the values of
metadata entries in both the SETUP and for requests. The same is also
enabled for data in the SETUP frame.

Close gh-23640
2019-11-20 19:41:16 +00:00
Rossen Stoyanchev f08cf0e864 Add RSocketFrameTypeMessageCondition constants
See gh-23999
2019-11-19 16:03:56 +00:00
Rossen Stoyanchev 842b424acd Use method signature to refine RSocket @MessageMapping
Before this change an @MessageMapping could be matched to any RSocket
interaction type, which is arguably too flexible, makes it difficult to
reason what would happen in case of a significant mismatch of
cardinality, e.g. request for Fire-And-Forget (1-to-0) mapped to a
method that returns Flux, and could result in payloads being ignored,
or not seen unintentionally.

This commit checks @ConnectMapping method on startup and rejects them
if they return any values (sync or async). It also refines each
@MessageMapping to match only the RSocket interaction type it fits
based on the input and output cardinality of the handler method.
Subsequently if a request is not matched, we'll do a second search to
identify partial matches (by route only) and raise a helpful error that
explains which interaction type is actually supported.

The reference docs has been updated to explain the options.

Closes gh-23999
2019-11-18 17:27:41 +00:00
Rossen Stoyanchev 32f82c0ed0 Polishing 2019-11-08 17:47:59 +00:00
Ilja 08f1cb454a Allow sending headers with the disconnect frame 2019-11-08 17:41:39 +00:00
Rossen Stoyanchev b2b02ad7a1 Polishing 2019-11-08 15:03:53 +00:00
Ilya Lukyanovich 801cca8cf8 Preserve ErrorMessage#getOriginalMessage()
See gh-23417
2019-11-08 15:03:53 +00:00
Rossen Stoyanchev 0e1a237139 Polishing 2019-11-08 09:17:25 +00:00
Johnny Lim 91f5f42d13 Add tests for PrincipalMethodArgumentResolver 2019-11-08 08:48:56 +00:00
Rossen Stoyanchev 005d2018d4 Refine changes for PR
Closes gh-23882
2019-10-31 14:14:44 +00:00
Dekel Pilli 64f2beb9bf Fixing NPE in AbstractNamedValueMethodArgumentResolver
See gh-23882
2019-10-31 14:13:44 +00:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis 3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Juergen Hoeller 19ff7d84ab Polishing 2019-10-30 14:31:46 +01:00
Sebastien Deleuze 9f242fac66 Add RSocketRequester retrieveAndAwaitOrNull extension
Closes gh-23874
2019-10-27 20:11:08 +01:00
Rossen Stoyanchev 739d2881fa Polishing 2019-10-23 14:55:55 +01:00
KateVasovski f77d23de94 @MessgeMapping support for Optional<Principal> 2019-10-23 14:51:07 +01:00
Juergen Hoeller 2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sebastien Deleuze 091c512f0d Upgrade to Coroutines 1.3.2
Closes gh-23663
2019-09-25 21:51:04 +02:00
Sebastien Deleuze c10dcec9ed Polishing 2019-09-25 21:48:47 +02:00
Sebastien Deleuze a4b278a269 Polishing 2019-09-25 17:02:05 +02:00
Sebastien Deleuze 5866693ece Add MetadataExtractorRegistry.metadataToExtract Kotlin extensions
Closes gh-23705
2019-09-25 17:02:05 +02:00
Rossen Stoyanchev e2baf7277b Use metadata slice
Take a slice of the metadata if not using composite metadata to allow
reading it multiple times. For composite metadata this is not an isuse
as it is ensured by the underlying RSocket Java API.
2019-09-23 13:32:28 +01:00
Brian Clozel 809009e6c4 Rename RSocketStrategies.Builder.metadataExtractors
This commit renames the `metadataExtractors` method to something that is
closer to the actual intent: addming new metadata extractors against the
registry given as a parameter of the `Consumer`.

The method is renamed to `metadataExtractorRegistry`.
2019-09-19 14:54:36 +02:00
Sebastien Deleuze 90b5e6ab48 Polishing
See gh-23649
2019-09-18 19:29:15 +02:00
Sebastien Deleuze 5adc3d6666 Fix RSocketRequester API for requests without payload
This commit makes it possible to send requests without
requiring to call data(Mono.empty()). It introduces a
dedicated MetadataSpec interface and merge ResponseSpec
into RequestSpec for more flexibility.

Closes gh-23649
2019-09-18 16:00:16 +02:00
Brian Clozel 848804a227 Allow registration of RSocket metadata extractors
Prior to this commit, customizing the extraction of RSocket metadata
from frames would require developers to override the default
`MetadataExtractor` while configuring `RSocketStrategies`.
This touches on many infrastructure parts, whereas the goal is just to
configure an extra metadata entry extractor using already configured
codecs.

This commit adds a way to register metadata entry extractors on the
`RSocketStrategies` builder with a `Consumer`-based API.

Closes gh-23645
2019-09-16 19:01:14 +02:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Sebastien Deleuze d587a660fc Fix a warning in Kotlin tests 2019-09-03 23:48:39 +02:00
Sebastien Deleuze 9b33b0ad58 Rename CoroutinesUtils#invokeHandlerMethod to invokeSuspendingFunction 2019-09-03 23:41:53 +02:00
Brian Clozel d4089747b8 Use dependency management in Framework build
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.

This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).

Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.

This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:

    ./gradlew dependencyUpdates
2019-09-02 18:01:09 +02:00
Sebastien Deleuze c13941821a Treat Kotlin warnings as errors
Closes gh-23566
2019-09-02 16:49:31 +02:00
Sebastien Deleuze ca02cc1194 Migrate to AssertJ in Kotlin tests
Closes gh-23475
2019-09-02 15:59:26 +02:00
Rossen Stoyanchev 58e9266e99 Add Consumer methods to RSocketRequester
Closes gh-23513
2019-09-02 13:31:28 +01:00
Rossen Stoyanchev b144c72937 Support ByteBuf as a metadata value
This allows encoding of metadata values externally via some
existing API for encoding RSocket metadata, rather than relying on
registered Encoders.

Also remove explicit checks for DataBuffer since those are supported
through the DataBufferEncoder (registered by default).

See gh-23513
2019-09-02 13:31:28 +01:00
Rossen Stoyanchev 71f3498a26 Switch to using RoutingMetadata API
Closes gh-23137
2019-09-02 13:31:28 +01:00
Rossen Stoyanchev 29a58ab045 Remove RSocket metadata MimeType constants
For public use, these constants aren't ideally exposed through an SPI
like MetadataExtractor, and there isn't any other obvious place either.
In practice the only public API where these can be passed in is
RSocketRequester and RSocketMessageHandler both of which already
default to composite metadata anyway, leaving only the routing MimeType
to be used potentially but much less likely.
Due to existence of similar constants in the RSocket itself, i.e.
WellKnownMimeType, we can get by internally too without declaring
MimeType constants from a central place.
2019-08-27 13:04:58 +03:00
Rossen Stoyanchev 45d0405624 Upgrade to RSocket 1.0 RC3 snapshots and...
take advantage of the symmetrical SocketAcceptor methods now available
on RSocketFactory for both client and server side.
2019-08-27 13:04:58 +03:00