Commit Graph

976 Commits

Author SHA1 Message Date
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Juergen Hoeller aa4ae7a750 Heart-beat log message potentially without session id
Issue: SPR-15937
2017-09-08 16:55:27 +02:00
Rossen Stoyanchev 39cefb5bd7 One more instance of modified method name in Mono 2017-09-05 13:59:45 -04:00
Juergen Hoeller 97ded1dcc7 Polishing 2017-09-01 14:05:35 +02:00
Juergen Hoeller 2b44e6e21c Strong references to mapped exception handler methods
Issue: SPR-15907
2017-08-29 15:07:23 +02:00
Brian Clozel 397fd24849 Revert "Leverage Kotlin plugin dependency management"
This reverts commit 3e2f6c848a.
2017-08-22 21:29:39 +02:00
Sebastien Deleuze 3e2f6c848a Leverage Kotlin plugin dependency management 2017-08-22 17:35:57 +02:00
Brian Clozel cc3d7d2d48 Apply dependency management to selected modules
This commit applies the Dependency Management Plugin to modules that
require it; right now Spring Framework is importing BOMs for Netty and
Reactor dependencies only.

Instead of applying those BOMs to all modules, they're applied only
where they're needed.

Issue: SPR-15885
2017-08-21 14:42:03 +02:00
Brian Clozel 2eeb428e95 Move modules to independent build files
The main `build.gradle` file contains now only the common build
infrastructure; all module-specific build configurations have
been moved to their own build file.

Issue: SPR-15885
2017-08-21 14:41:55 +02:00
Juergen Hoeller fac1f236c3 Upgrade to Servlet API 4.0 for MVC and merge EhCache 3 tests into spring-context-support
Includes general streamlining of dependency declarations with reduced version variables, direct use of EclipseLink 2.7 and its implicit JPA 2.2 dependency in spring-orm, mixed use of Hibernate 5.2.10 and 5.1.10 for integration tests, as well as an upgrade to Jetty 9.4.7 RC0 and a downgrade to Groovy 2.4.12 (since Groovy 2.5 won't be final in time for Spring Framework 5.0).

Issue: SPR-15879
Issue: SPR-15880
2017-08-21 01:34:11 +02:00
Stephane Nicoll f6e7fef236 Polish 2017-08-19 10:50:41 +02:00
Juergen Hoeller b94302b5bd Enforce non-null value from getBean and at injection points
Bean-derived null values may still get passed into bean properties and injection points but only if those are declared as non-required. Note that getBean will never return null; a manual bean.equals(null) / "null".equals(bean.toString()) check identifies expected null values now.  This will only ever happen with custom FactoryBeans or factory methods returning null - and since all common cases are handled by autowiring or bean property values in bean definitions, there should be no need to ever manually check for such a null value received from getBean.

Issue: SPR-15829
2017-08-18 00:11:35 +02:00
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Juergen Hoeller adeb521ce4 Polishing 2017-08-08 17:27:28 +02:00
Sebastien Deleuze ed6fe2b723 Upgrade to Kotlin 1.1.4-eap-33
Issue: SPR-15814
2017-07-24 17:29:02 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Juergen Hoeller 9fc4fb10b0 Nullability fine-tuning around bean properties
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 11:43:58 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Rossen Stoyanchev 095cc2283e Replace constant from QueueSupplier with local one 2017-07-13 22:07:19 +02:00
Juergen Hoeller 5f767a86f5 Always invoke Jackson serialization with AtomicReference cause
Issue: SPR-15760
2017-07-12 19:13:03 +02:00
Alan Hong fc7e7a3304 Fix typo
closes gh-1465
2017-07-12 17:12:34 +02:00
Juergen Hoeller 122ee3096c Efficient log checks in STOMP encoder/decoder 2017-07-10 20:44:51 +02:00
Violeta Georgieva fd1859c34c Adapt to the changes in Reactor Netty ClientOptions
ClientOptions/HttpClientOptions are now created via Builder
2017-07-04 15:26:29 +02:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Juergen Hoeller 7e251274ee Consistent nullability of headers Map and MessagePostProcessor
Issue: SPR-15670
2017-06-15 22:45:06 +02:00
Stephane Nicoll 1ab678a2a3 Polish "Refactor iterator of Map with Java8's Map.forEach"
Closes gh-1459
2017-06-13 16:06:20 +02:00
diguage 1ef5f61ab2 Refactor iterator of Map with Java8's Map.forEach
See gh-1459
2017-06-13 16:06:20 +02:00
Juergen Hoeller 7dd8dc62a5 Fixes for ignored tests after last week's nullability commit
Issue: SPR-15540
2017-06-13 11:37:58 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Arjen Poutsma 9bf82dc18f Add addAll(MultiValueMap)
This commit introduces a new method for MultiValueMap: addAll, which
adds all values of a given map (cf putAll, which replaces existing
values).
2017-06-12 14:12:12 +02:00
diguage c1d44d9a34 Use the diamond syntax
Closes gh-1450
2017-06-12 09:19:06 +02:00
Rob Winch b1345014b9 Update to Reactor Bismuth-M2
Issue: SPR-15646
2017-06-09 09:49:31 -05:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller 7eaedf2916 Debug-level log entry for any Jackson exception during canConvert
Issue: SPR-15582
2017-06-07 18:33:19 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Rossen Stoyanchev 4a3f6e4546 Polish 2017-05-31 22:43:25 -04:00
Christoph Dreis 0ef1623643 Optimize DefaultUserDestinationResolver.resolveDestination()
Issue: SPR-15602
2017-05-31 22:37:42 -04:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Gary Russell f9b319d3ba Revert Incorrect MessagingTemplate Change
The change to "optimize" the template by not rebuilding the reply
message when the original header channels was null was incorrect.

We need to null out those headers if they were originally null.

Issue: SPR-15991
2017-05-31 15:12:46 -04:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Gary Russell e06c4d5116 Timeout Overrides in Messaging Templates
Provide a mechanism to override the configured send and receive
timeouts in the GenericMessagingTemplate.

- overload `doReceive()` to take a receive timeout argument
- for `sendAndReceive()` methods examine message headers for these
  timeout values
  - remove headers to avoid propagation
  - avoid the unconditional rebuild of the reply message if the
    original headers weren't present
- also remove headers from simple `send()` operations
- change javadocs for the setters to indicate they are now defaults
- add properties to allow the user to override the header names used
- change `TemporaryReplyChannel` to use `send` arg and change to static
  - add package-protected ctor to avoid the compiler creating a
    synthetic constructor for access

Issue: SPR-15591
2017-05-30 17:03:46 -04:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Rossen Stoyanchev b6e252495a Protect against NPE in DefaultSubscriptionRegistry
Follow-up fix on the recent commit:
https://github.com/spring-projects/spring-framework/commit/44c31a

Issue: SPR-15543
2017-05-22 16:08:34 -04:00
Bao Tran 44c31a6aad Fix duplicate STOMP subscription id issue
Issue: SPR-15543
2017-05-19 15:20:14 -04:00
Juergen Hoeller 9e3f4ccce9 Merge pull request #1394 from alexander-riss/keySet
Fix inefficient use of keySet operators in messaging classes

Issue: SPR-15553
2017-05-16 11:22:22 +02:00
Alexander Riss e49a5d8424 fix inefficient use of keySet operators in messaging classes
issue: SPR-15553
2017-05-16 10:41:22 +02:00
Juergen Hoeller e93e49f268 ErrorMessage.toString() includes original message at top level
Issue: SPR-15459
2017-04-19 20:50:20 +02:00
Gary Russell e677342628 Add originalMessage to ErrorMessage
Issue: SPR-15459
2017-04-19 14:04:25 -04:00
Sebastien Deleuze 4d9144132e Upgrade to Reactor Core 3.1
Issue: SPR-15318
2017-04-11 18:13:04 +02:00
Juergen Hoeller 5986f881d0 HandlerMethod evaluates ResponseStatus annotation for early caching
Issue: SPR-15227
2017-04-08 15:56:05 +02:00
Brian Clozel b799013567 Update to Reactor Aluminium SNAPSHOT
Currently the BOM versions are:

* reactor-core 3.0.6.BUILD-SNAPSHOT
* reactor-netty 0.6.2.BUILD-SNAPSHOT

This commit fixes as well a few deprecations in reactor-core.
2017-03-10 15:20:40 +01:00
stonio 7d062df992 Use String#isEmpty()
Closes gh-1335
2017-02-22 11:55:17 +01:00
Juergen Hoeller d2cc97af47 Polishing 2017-02-21 22:41:40 +01:00
Rossen Stoyanchev f219680d42 Add equals/hashcode for STOMP Subscription
Issue: SPR-15229
2017-02-21 15:05:06 -05:00
Stephane Maldini ba97432043 prepare for reactor-netty 0.6.1.RELEASE 2017-02-21 16:00:19 +00:00
Juergen Hoeller 370e3d683a Polishing 2017-02-20 23:00:12 +01:00
Juergen Hoeller 74bdcd8ed4 MutableMessageHeaders serializes itself as regular MessageHeaders
Issue: SPR-15262
2017-02-17 20:59:17 +01:00
Juergen Hoeller 50d93d3794 Consistently support CompletionStage next to CompletableFuture
Issue: SPR-15258
2017-02-15 23:16:11 +01:00
Rossen Stoyanchev 60517b23e2 StompSession supports custom headers for UNSUBSCRIBE
Issue: SPR-15131
2017-01-31 17:55:53 -05:00
Juergen Hoeller 9b26fcd7d2 Refined assertion messages
Issue: SPR-15196
2017-01-31 15:56:39 +01:00
Juergen Hoeller 1b2dc3638f Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
2017-01-30 22:15:55 +01:00
Arjen Poutsma 69c16f3821 Add headers in InterceptingClientHttpRequest
This commit *adds* the "intercepted" headers to the ClientHttpRequest,
as opposed to replacing them, which is what happened before this commit.

Issue: SPR-15166
2017-01-30 14:18:50 +01:00
Juergen Hoeller 8038fb9c8b HandlerMethod pre-resolves parameter types at construction time
Issue: SPR-15186
2017-01-25 11:09:43 +01:00
Juergen Hoeller 12973ac702 Polishing 2017-01-24 00:12:53 +01:00
Juergen Hoeller f095aa20eb Polishing 2017-01-23 21:28:40 +01:00
Juergen Hoeller e9db4d6f96 Proper resolution of Optional.empty() for header arguments
Issue: SPR-15151
2017-01-17 10:46:37 +01:00
Juergen Hoeller 62e530ec94 Resolve minor 4.3.x deprecations in master
Issue: SPR-15139
2017-01-16 21:43:12 +01:00
Juergen Hoeller 047786acef Revised InvocableHandlerMethod exception messages (controller vs endpoint vs handler)
Introduces dedicated MethodArgumentResolutionException for spring-messaging invocations.

Issue: SPR-15139
2017-01-16 21:14:46 +01:00
Juergen Hoeller 7c05b427a7 MimeTypeUtils constants cleanup: removed web media types
Issue: SPR-15137
2017-01-12 23:30:57 +01:00
Juergen Hoeller 743ce2cda6 Polishing 2017-01-12 23:30:38 +01:00
Sam Brannen 9ed66bf2eb Clean up warnings across code base 2017-01-07 01:54:38 +01:00
Gary Russell 80bc8fc596 Implement MessagingException.toString()
Issue: SPR-15091
Closes gh-1284
2017-01-05 10:25:04 +01:00
Rossen Stoyanchev e62b104e03 Resource cleanup on shutdown in ReactorNettyTcpClient 2016-12-28 21:37:12 -05:00
Rossen Stoyanchev 698c885e06 Reconnect failures delegated to TcpConnectionHandler
When connecting with a ReconnectStrategy we can only report the outcome
of the first connect to the ListenableFuture<Void> return value.

Failures for all subsequent attempts to reconnect however must be
channeled to TcpConnectHandler#afterConnectFailure which is used in
the STOMP broker relay for example to publish
BroadcastAvailability(true/false) events.
2016-12-28 21:37:07 -05:00
Rossen Stoyanchev ea274ebc0a Fix decoding issue in Reactor TcpClient
When decoding STOMP messages unread portions of a given input ByteBuf
must be kept until more input is received and the next complete STOMP
frame can be parsed.

In Reactor Net 2.x this was handled for us through the "remainder"
field in NettyChannelHandlerBridge. The Reactor Netty 0.6 upgrade
however applied only a simple map operator on the input ByteBuf
after which the buffer is relased.

This commit replaces the use of a simple map operator for decoding
and installs a ByteToMessageDecoder in the Netty channel pipeline
which has a built-in ability to preserve and merge unread input into
subsequent input buffers.
2016-12-28 21:36:37 -05:00
Rossen Stoyanchev fdf88c9795 Workaround for onReadIdle issue in Reactor TcpClient
https://github.com/reactor/reactor-netty/issues/22
2016-12-28 21:36:37 -05:00
Rossen Stoyanchev 2a3e01399a Polish ReactorNettyTcpClient 2016-12-28 21:36:37 -05:00
Juergen Hoeller 5c48daa8eb Remove unused Log object from MessageHeaderAccessor
Issue: SPR-15045
2016-12-22 23:34:19 +01:00
Juergen Hoeller ae62341fa3 Avoid deprecated Scheduler.shutdown() in favor of Scheduler.dispose() 2016-12-22 22:35:54 +01:00
Juergen Hoeller 4c005e6336 ResolvableType-based matching respects generic factory method return type
Includes consistent use of ResolvableType.resolve() wherever applicable.

Issue: SPR-15011
2016-12-17 23:10:48 +01:00
Stephane Maldini 2802926c1d update STOMP support to reactor-netty 0.6 2016-12-13 17:31:09 +00:00
Stephane Maldini 70bab23609 update STOMP support to reactor-netty 0.6 2016-12-13 17:29:43 +00:00
Rossen Stoyanchev b3fa1b40a0 Synchronized updates of STOMP header key cache
Issue: SPR-14901
2016-12-08 11:13:57 -05:00
Christoph Dreis 9b76dc2ab4 SPR-14901 Allow customization of STOMP message header encoding
Fixes SPR-14901
2016-12-08 11:13:56 -05:00
Sergei Ustimenko e4ed1f6ffd ChannelFutureMono renamed to FutureMono
In the latest reactor-netty there is renaming
of ChannelFutureMono class to FutureMono. Thus
build fails on the latest master.
2016-12-03 18:56:42 +01:00
Juergen Hoeller f6fc0a86b3 Polishing
(cherry picked from commit 0028b29)
2016-12-01 20:11:47 +01:00
Rossen Stoyanchev b874692452 Simplify ReactorNettyTcpClient input
Create a ReactorNettyCodec to hold the decoding and encoding function
and consumer along with a package-private sub-class that delegates to
StompDecoder and StompEncoder.

Issue: SPR-14531
2016-11-30 21:17:04 -05:00
Rossen Stoyanchev 85c93f5d67 Polish Reactor Netty TCP client support 2016-11-30 21:17:04 -05:00
Stephane Maldini 870f61fd8e update STOMP support to reactor-netty 2016-11-30 21:17:04 -05:00
Juergen Hoeller 5458a427a1 Polishing 2016-11-30 22:31:47 +01:00
Rossen Stoyanchev a203b74d20 PayloadArgumentResolver has useDefaultResolution flag
Issue: SPR-14937
2016-11-28 17:00:22 -05:00
Sebastien Deleuze a143b57d4b Polish Kotlin nullable support
This commit polishes Kotlin nullable support by reusing
MethodParameter#isOptional() instead of adding a new
MethodParameter#isNullable() method, adds
Kotlin tests and introduces Spring Web Reactive
support.

Issue: SPR-14165
2016-11-24 18:28:50 +01:00
Raman Gupta fada91e538 Treat Kotlin nullable as non-required
Where `isOptional` is used, also check for `isNullable` i.e.
values are not considered required if they are Kotlin nullables:
- spring-messaging: named value method arguments
- spring-web: named value method arguments
- spring-webmvc: request parts

This means that Kotlin client code no longer has to explicity specify
"required=false" for Kotlin nullables -- this information is inferred
automatically by the framework.

Issue: SPR-14165
2016-11-24 17:18:55 +01:00
Juergen Hoeller 80931b211c Shared DefaultConversionService instance for simple fallback purposes
Issue: SPR-14948
2016-11-24 15:29:17 +01:00
Juergen Hoeller 9bf4d7cf4e Polishing 2016-11-22 14:57:00 +01:00
Christoph Dreis a929e9ccaa Implement allocation-friendly method to get user count in SimpUserRegistry
SPR-14930
2016-11-21 21:02:10 +01:00
Juergen Hoeller ac774cdcef Avoid deprecated Mockito methods
Issue: SPR-14880
2016-11-04 12:24:46 +01:00
Juergen Hoeller 84d3808b3b Upgrade to Mockito 2.2
Issue: SPR-14880
2016-11-03 22:53:35 +01:00
Juergen Hoeller dc080cb1be Revised NoSuchBeanDefinitionException message and ResolvableType handling
Includes consistent quoting of qualified type names in related classes.

Issue: SPR-14831
2016-10-28 23:39:05 +02:00
Juergen Hoeller dbaafdd04e MessageChannel declares send(Message) as default method
Issue: SPR-14854
2016-10-28 15:11:03 +02:00
Juergen Hoeller 3726c6f18d Polishing 2016-10-21 12:26:27 +02:00
Juergen Hoeller eafaaa5cb8 Polishing 2016-10-12 17:11:04 +02:00
Juergen Hoeller ffc781b163 Explicit calls on Buffer base type (for compatibility with covariant return type on JDK 9's ByteBuffer)
Issue: SPR-14645
2016-10-05 00:10:06 +02:00
Juergen Hoeller fb7ae010c8 Avoid unnecessary generics on emptyMap/Set/List 2016-09-26 18:04:49 +02:00
Juergen Hoeller a6b0b6e279 Efficient STOMP content-length header check
Issue: SPR-14747
2016-09-26 17:25:21 +02:00
Juergen Hoeller c64f39943f Polishing 2016-09-26 17:20:30 +02:00
Juergen Hoeller e188b4428e Polishing 2016-09-25 21:00:07 +02:00
Christoph Dreis 774e4c3dc1 Improve performance of StompEncoder
Fixes SPR-14747
2016-09-25 19:09:01 +02:00
Rossen Stoyanchev 99c7917124 Reset connection before delegating to handler
Resetting the connection first before invoking a failure callback on
the application handler ensures that any checks to isConnected will
return false.

Issue: SPR-14721
2016-09-19 09:04:23 -04:00
Juergen Hoeller 6dc1898dbb Timeout exceptions as RuntimeExceptions
Issue: SPR-14669
2016-09-15 08:54:17 +02:00
Rossen Stoyanchev 3bc1121b9d Check both connection and connected flag
Issue: SPR-14703
2016-09-14 17:19:49 -04:00
Juergen Hoeller f592599349 Polishing
(cherry picked from commit 54db496)
2016-09-13 23:48:41 +02:00
Juergen Hoeller 03609c1518 Consistent comma splitting without regex overhead
Issue: SPR-14635
2016-08-30 23:56:58 +02:00
Rossen Stoyanchev 8b4f60b8e5 Support receipt on DISCONNECT with simple broker
Issue: SPR-14568
2016-08-29 18:31:19 -04:00
Juergen Hoeller 899ebd8ee2 Avoid collection lookups in StompCommand
Issue: SPR-14636
2016-08-29 11:54:21 +02:00
Juergen Hoeller dfdfd72a3e Polishing
(cherry picked from commit 430180a)
2016-08-26 18:59:40 +02:00
Juergen Hoeller 2e4a7480fc Consistent use of JDK 7 StandardCharsets over Charset.forName
Issue: SPR-14492
2016-08-26 14:16:19 +02:00
Juergen Hoeller 14046575b0 Polishing 2016-08-26 13:27:33 +02:00
Juergen Hoeller f3f691cc37 Revised assertions in StompHeaderAccessor
Issue: SPR-14625
2016-08-24 21:04:01 +02:00
Juergen Hoeller c4fff6db1b Reintroduced MessageMethodArgumentResolver default constructor
Issue: SPR-14616
2016-08-23 13:20:02 +02:00
Juergen Hoeller eeeab27f1f Polishing
(cherry picked from commit 35e247a)
2016-08-10 16:42:21 +02:00
Juergen Hoeller 59a24b406a Polishing 2016-08-10 14:20:42 +02:00
Juergen Hoeller 5db449556b Polishing 2016-07-27 16:21:55 +02:00
Juergen Hoeller 6d5af60a7c Expose DefaultSubscriptionRegistry's cache limit through SimpleBrokerMessageHandler and MessageBrokerRegistry
Issue: SPR-14516
2016-07-27 12:11:58 +02:00
Juergen Hoeller e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Marius Grama 3635c9dbfe Update xmlunit library to version 2.1.0
xmlunit 2.1.0 is the latest release for xmlunit.
Most of the xmlunit functionality used within spring-framework
was done through the xmlunit 1.x helper class
`org.custommonkey.xmlunit.XMLAssert`.

As of xmlunit 2.0.0 most of the XML comparison methods are done
through hamcrest matchers exposed by the xmlunit-matchers
library. In some cases during the migration, the matchers
had to be customized with custom `NodeMatcher` or
`DifferenceEvaluator` instances in order to keep the assertions
correct (they were performed with xmlunit 1.x previously).

Issue: SPR-14043
2016-07-21 15:04:21 +02:00
Juergen Hoeller 99be15f58b Revise encoding steps towards use of JDK Charset and StandardCharsets
Issue: SPR-14492
2016-07-19 23:43:06 +02:00
Juergen Hoeller a4743c07d4 Polishing 2016-07-19 20:09:00 +02:00
Juergen Hoeller aaac199e8b Consistently use constructor-based instantiation instead of Class.newInstance / BeanUtils.instantiate
Issue: SPR-14486
2016-07-19 19:21:06 +02:00
Juergen Hoeller b1663585dc MessageHeaderAccessor properly removes header even in case of null value
Issue: SPR-14468
2016-07-15 00:15:46 +02:00
Juergen Hoeller a1f5fb53db Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
2016-07-07 01:04:24 +02:00
Stephane Nicoll e4b0486c5a Add @FunctionalInterface on candidate interfaces
Issue: SPR-14432
2016-07-06 14:32:13 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Stephane Nicoll 00d2606b00 Explicit type can be replaced by <>
Issue: SPR-13188
2016-07-05 17:00:34 +02:00
Juergen Hoeller b5db5d3aac Broadly remove deprecated core classes and methods
Issue: SPR-14430
2016-07-05 15:52:49 +02:00
Juergen Hoeller 51252ebbca Avoid defensive checks against Java 8 API (java.util.Optional etc)
This commit also fixes broken javadoc links and code references.

Issue: SPR-13188
2016-07-05 02:09:00 +02:00
Juergen Hoeller f6334fc62b Aligned default Map capacity 2016-07-02 15:17:34 +02:00
Juergen Hoeller b204437cef Polishing 2016-07-02 14:48:15 +02:00
Juergen Hoeller e5122d084a Avoid wrapping in plain RuntimeException in favor of IllegalStateException 2016-07-02 13:03:33 +02:00
Juergen Hoeller e5de7d5455 @MessageExceptionHandler matches cause as well (analogous to @ExceptionHandler)
Issue: SPR-14424
2016-07-02 12:56:37 +02:00
Juergen Hoeller cfc560c4c4 Leniently accept custom DeferredResult etc subclasses for null values
Issue: SPR-14423
2016-07-02 12:55:30 +02:00
Rossen Stoyanchev ebdc770ed3 Use appropriate message id header for STOMP 1.1 vs 1.2
Issue: SPR-14391
2016-06-27 16:12:59 -04:00
Juergen Hoeller f5282bc1e3 PayloadArgumentResolver's MessageConversionException includes original payload type
Issue: SPR-14394
2016-06-23 17:32:30 +02:00
Juergen Hoeller a9fda3e7e2 Defensive catching of any Throwable subclasses instead of just Error
Issue: SPR-14329
2016-06-04 00:17:20 +02:00
Juergen Hoeller e4976a2c6d ExecutorSubscribableChannel consistently rethrows Error as MessageDeliveryException
Issue: SPR-14323
2016-06-01 11:38:56 +02:00
Rossen Stoyanchev 1e003a1c90 Remove unnecessary assertion
Issue: SPR-14279
2016-05-18 10:57:54 -04:00
Rossen Stoyanchev 4a81aaba6c Fix STOMP connect failure related memory leak
Normally heartbeats keep connections from hanging. However in some
cases a connection may hang before a CONNECTED frame is received
and heartbeats are put in place. This commit adds a change to enforce
a 60 limit on receiving the CONNECTED frame.

Issue: SPR-14266
2016-05-12 11:24:50 -04:00
Juergen Hoeller c15f27cfa8 Avoid package import cycle through explicit javadoc reference 2016-05-06 13:41:02 +02:00
Sam Brannen 7b13311f03 Delete unused imports 2016-05-03 20:12:37 +02:00
Rossen Stoyanchev 46e41a9d94 Consolidate SendTo vs SendToUser detection
SendTo and SendToUser are treated as mutually exclusive. The addition of
type-level support in 4.3. RC1 however did not consider the possibility
to mix and match of the two betwee type and method level.

This commit consolidates the detection of SendTo and SendToUser
annotations and considers them all together.

Issue: SPR-14238
2016-05-03 12:34:19 -04:00
Juergen Hoeller f83cbff543 Consistent SmartLifecycle implementations
Issue: SPR-14233
2016-05-02 13:01:44 +02:00
Rossen Stoyanchev bd40a93604 Ensure Environment.shutdown() in Reactor2TcpClient
Issue: SPR-14229
2016-04-28 17:47:59 -04:00
Rossen Stoyanchev 220711d45b Reactor2TcpClient cleans up TcpClient instances
Issue: SPR-14231
2016-04-28 15:27:53 -04:00
Rossen Stoyanchev 9798912557 Add missing @since tag 2016-04-26 16:48:45 -04:00
Rossen Stoyanchev 06b2d2b89e STOMP client session supports sending ack/nack
Issue: SPR-14208
2016-04-26 16:44:58 -04:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Juergen Hoeller f1cb793ccb Rename MimeType's getCharSet() to getCharset()
Issue: SPR-14172
2016-04-14 16:38:59 +02:00
Juergen Hoeller 5f4e838f41 Jackson-based message converters do not log warning for serializer not found
Issue: SPR-14163
2016-04-14 14:13:13 +02:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Juergen Hoeller 5025c615b1 Consistent use of AnnotatedElementUtils.findMergedAnnotation/hasAnnotation
Issue: SPR-13440
2016-03-23 18:39:20 +01:00
Rossen Stoyanchev 183594207f Support user destinations without leading slash
Before this commit the DefaultUserDestinationResolver did not support
well broker destinations that use dot as separator with a built in
assumptions that the destinations it resolves must start with slash.

This change adds PathMatcher property that is used to determine if
an alternative path separator is in use and if so the leading slash is
left out.

Issue: SPR-14044
2016-03-15 17:50:13 -04:00
Rossen Stoyanchev 68f6cf9d3a Support same user connected to multiple servers
The MultiServerUserRegistry now supports scenarios where the same user
is connected to multiple servers. For such cases the SimpUser returned
from the registry exposes all sessions across all servers.

Issue: SPR-13800
2016-03-10 14:37:22 -05:00
Rossen Stoyanchev 6aa216afb6 Polish SimpUserRegistry related classes
Issue: SPR-13800
2016-03-10 14:37:22 -05:00
Rossen Stoyanchev 18a59dad52 Minor Javadoc update 2016-02-18 18:11:59 -05:00
Rossen Stoyanchev 416966d943 Support Message argument with payload conversion
The MessageMethodArgumentResolver now also supports applying a
MessageConverter to the payload.

This is effectively a shortcut for declaring a method with an @Payload
argument + MessageHeaders and then creating a new message from the two.

Issue: SPR-13288
2016-02-18 18:09:16 -05:00
Rossen Stoyanchev ec3571fd4d Polish 2016-02-18 18:09:16 -05:00
Juergen Hoeller e0d7c6be00 Name attributes in method argument annotations allow for placeholders and expressions
Issue: SPR-13952
2016-02-17 22:59:12 +01:00
Juergen Hoeller 8558cbc9bf Polishing 2016-02-10 19:40:47 +01:00
Juergen Hoeller 901c2d5f74 Consistent API between spring-web and spring-messaging HandlerMethod infrastructure
Issue: SPR-13929
2016-02-10 16:23:11 +01:00
Rossen Stoyanchev e81c7dfc4c Polish SendToMethodReturnValueHandlerTests 2016-01-29 16:16:21 -05:00
Rossen Stoyanchev 03e3ef53ab @SendToUser supported on the class level
Issue: SPR-12047
2016-01-29 16:10:02 -05:00
Juergen Hoeller b4f33adf48 Consistent java.util.Optional resolution, lenient handling of optional multipart files, correct Servlet 3.0 Part list/array selection
Issue: SPR-13418
Issue: SPR-13849
Issue: SPR-13850
Issue: SPR-13893
2016-01-26 18:06:15 +01:00
Stephane Nicoll a112557dc4 Support SendTo at class-level
Issue: SPR-13578
2016-01-16 16:34:02 +01:00
Stephane Nicoll 2fc2c29e9a Update copyright header 2016-01-15 10:51:11 +01:00
Rossen Stoyanchev 3dae3fd8a9 Refine ListenableFutureCallback policy for exceptions
This change updates all cases where callbacks are invoked to catch and
suppress errors (since there is not match to do with and error from
a callback be it success or failure).

Also updated is the contract itself to clarify this and emphasize the
callbacks are really notifications for the outcome of the
ListenableFuture not the callbacks themselves.

Issue: SPR-13785
2016-01-14 17:49:01 -05:00
Sam Brannen 5b3edcd9f9 Spring Cleaning in December
- Delete unused imports
- Delete unused code
- Clean up warnings
2015-12-17 20:27:33 +01:00
Juergen Hoeller 8ce5e88c66 Require Jackson 2.6+, FreeMarker 2.3.21+, XStream 1.4.5+
Issue: SPR-13062
2015-12-17 17:14:50 +01:00
Juergen Hoeller 753347ea98 Consistent static final logger declarations 2015-12-16 20:44:00 +01:00
Juergen Hoeller bdb606b8b1 Polishing 2015-12-13 23:27:05 +01:00
Juergen Hoeller beef5ff4c3 Polishing 2015-12-10 01:12:58 +01:00
Juergen Hoeller ca9a078d82 Polishing 2015-12-10 00:31:37 +01:00
Juergen Hoeller f119962378 SimpAnnotationMethodMessageHandler ignores empty marker annotations
Issue: SPR-13704
2015-12-10 00:30:50 +01:00
Juergen Hoeller 11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00
Juergen Hoeller 8c4436926f Polishing 2015-11-26 02:09:37 +01:00
Juergen Hoeller a0747c2148 Consistent bean type checking for endpoint handlers
Issue: SPR-13725
2015-11-25 21:26:03 +01:00
Juergen Hoeller e8417ea6e1 SimpAnnotationMethodMessageHandler skips template variable check in case of no pattern
Issue: SPR-13704
2015-11-24 17:37:12 +01:00
Juergen Hoeller 760bc719f2 Polishing 2015-11-09 15:03:14 +01:00
Juergen Hoeller bc7bcab578 Consistent method selection for listeners and endpoint mappings
Issue: SPR-13654
2015-11-09 14:57:45 +01:00
Juergen Hoeller 23c8f712c4 Polishing 2015-11-02 21:30:03 +01:00
Juergen Hoeller cca037a74d Polishing 2015-11-02 14:42:46 +01:00
Sebastien Deleuze 994a11da3e Document default charset in Jackson message converters Javadoc
Issue: SPR-13600
2015-10-26 11:39:00 +01:00
Rossen Stoyanchev 922e6de788 Avoid filtering if selector header is not in use 2015-10-13 12:14:17 -04:00
Rossen Stoyanchev 7ff915a01a Enforce cacheLimit in DefaultSubscriptionRegistry
When the cacheLimit is reached and there is an eviction from the
updateCache, the accessCache is now also updated.

This change also ensures that adding a destination to the cache is
protected with synchronization on the updateCache.

Issue: SPR-13555
2015-10-13 12:14:16 -04:00
Juergen Hoeller 181533c464 MessageHeaders serialization preserves non-serializable entries in original instance
Issue: SPR-13541
2015-10-06 13:24:05 +02:00
Rossen Stoyanchev 8c316e1863 Avoid issue with switching from Reactor 2.0.5 to 2.0.6
We can't compile directly against NettyClientSocketOptions method which
changed signatures in 2.0.6. This change ensures the method is invoked
reflectively instead.
2015-09-30 18:43:07 -04:00
Rossen Stoyanchev c75206f975 Prepare for Reactor 2.0.6 2015-09-29 10:42:44 -04:00
Rossen Stoyanchev daa49c9bcd StompDecoder handles partial headers correctly
Issue: SPR-13416
2015-09-23 16:51:55 -04:00
Juergen Hoeller c4f5a0fb10 MessagingException provides null description (instead of empty String) to NestedRuntimeException
Issue: SPR-13447
2015-09-09 11:42:59 +02:00
Juergen Hoeller 667fc7e4a9 Polishing 2015-09-04 14:38:47 +02:00
Rossen Stoyanchev 4ecb3d4f3f Update WebSocket docs on proxying @Controller
Issue: SPR-13384
2015-08-25 22:14:36 -04:00
Juergen Hoeller 8cd283729b MessageHeaders returns completely immutable entry set (no entry.setValue call allowed)
Issue: SPR-13385
2015-08-25 17:54:54 +02:00
Juergen Hoeller 3d2e2cb3ae Upgrade to Reactor 2.0.5 2015-08-17 13:00:29 +02:00
Juergen Hoeller a369fc8afd Introduce SmartMessageConverter interface with conversionHint arguments
Issue: SPR-13343
2015-08-12 17:45:46 +02:00
Juergen Hoeller 9ef38807e6 Polishing 2015-07-30 19:34:33 +02:00
Juergen Hoeller b1d6ae77e1 Polishing 2015-07-30 00:08:36 +02:00
Sam Brannen 725292081e Introduce 'value' alias for 'attribute' in @AliasFor
SPR-11512 introduced support for annotation attribute aliases via
@AliasFor, requiring the explicit declaration of the 'attribute'
attribute. However, for aliases within an annotation, this explicit
declaration is unnecessary.

This commit improves the readability of alias pairs declared within an
annotation by introducing a 'value' attribute in @AliasFor that is an
alias for the existing 'attribute' attribute. This allows annotations
such as @ContextConfiguration from the spring-test module to declare
aliases as follows.

public @interface ContextConfiguration {

     @AliasFor("locations")
     String[] value() default {};

     @AliasFor("value")
     String[] locations() default {};

    // ...
}

Issue: SPR-13289
2015-07-29 15:27:06 +02:00
Juergen Hoeller 02d05ed133 Consistent lookup of parameter-level JsonView annotation
Issue: SPR-13265
2015-07-29 01:05:25 +02:00
Juergen Hoeller d83735694e Polishing 2015-07-28 12:15:48 +02:00
Rossen Stoyanchev 4b4efa9f6e Placeholder support for STOMP @MessageMapping methods
Issue: SPR-13271
2015-07-27 16:54:21 -04:00
Rossen Stoyanchev a65e0369f4 Polish SimpAnnotationMethodMessageHandlerTests 2015-07-27 16:54:21 -04:00
Juergen Hoeller 0f54f686b2 PayloadArgumentResolver supports JsonView as well (through AbstractMessageConverter revision)
AbstractMessageConverter provides overloaded methods with a conversion hint, MappingJackson2MessageConverter takes that hint into account, and SimpMessagingTemplate transformes such a hint in the given headers map into an explicit argument invocation argument.

Issue: SPR-13265
2015-07-24 17:50:31 +02:00
Juergen Hoeller f06581f5b8 Polishing 2015-07-22 14:20:12 +02:00
Juergen Hoeller edd6e76b9f Polishing 2015-07-21 22:58:34 +02:00
Juergen Hoeller 203f1225c3 Polishing 2015-07-17 15:25:43 +02:00
Juergen Hoeller 2a36abcaea Polishing 2015-07-07 16:44:19 +02:00
Sebastien Deleuze 97936140cc Support HandlerMethod parameter in @MessageExceptionHandler
Issue: SPR-13196
2015-07-07 15:43:39 +02:00
Juergen Hoeller f79a5c12d5 DefaultSubscriptionRegistry defensively checks for removal between keySet and get calls
Issue: SPR-13205
2015-07-07 11:11:56 +02:00
Juergen Hoeller fefc4b478f Polishing 2015-07-07 02:22:44 +02:00
Juergen Hoeller 145d88d152 Polishing 2015-07-07 00:26:31 +02:00
Juergen Hoeller f0175bc42d DefaultSubscriptionRegistry uses deep LinkedMultiValueMap copies between accessCache and updateCache
Issue: SPR-13185
2015-07-07 00:25:47 +02:00
Rossen Stoyanchev 16cbfcfd2f Add test to demonstrate 4.2 not affected by SPR-13185
Issue: SPR-13185
2015-07-06 17:32:55 -04:00
Rossen Stoyanchev 0b43e4e4f2 Add concurrent test and fix potential NPE
After SPR-12884 (4.2 RC1) introduced support for a selector header
expression on SUBSCRIBE frames, messages from the destination cache
are further filtered based on the selector expression. While adding a
test to find subscriptions at the same time as unsubscribing, a
potential NPE was exposed. This commit fixes the NPE.

Issue: SPR-13204
2015-07-06 17:07:20 -04:00
Rossen Stoyanchev 5dcbc5db29 Polish DefaultSubscriptionRegistryTests 2015-07-06 17:07:20 -04:00
Juergen Hoeller dc1f921f5c Split between basic MethodParameter and SynthesizingMethodParameter
This split avoids a package tangle (between core and core.annotation) and also allows for selective use of raw annotation exposure versus synthesized annotations, with the latter primarily applicable to web and message handler processing at this point.

Issue: SPR-13153
2015-06-30 00:02:02 +02:00
Sam Brannen 078d252d1e Delete trailing whitespace in Java source code 2015-06-19 17:09:52 +02:00
Rossen Stoyanchev 1153969ea2 Polish 2015-06-15 14:56:56 -04:00
Josh King 11824893a9 Header values are optional in Stomp 1.1 and 1.2 2015-06-15 14:56:56 -04:00
Sam Brannen ab24592662 Introduce alias for 'value' attribute in @SendToUser
Issue: SPR-11393
2015-06-01 14:14:23 +02:00
Sam Brannen 53d095aa28 Polish Javadoc for @SubscribeMapping 2015-06-01 13:56:44 +02:00
Sam Brannen a6f53ef2a7 Polish Javadoc for @MessageMapping 2015-06-01 13:37:08 +02:00
Sam Brannen 7b10dc6e93 Fix typo in Javadoc 2015-05-29 23:24:09 +02:00
Sam Brannen 60a5ec87d0 Introduce alias for 'value' attribute in @Header
This commit introduces 'name' as an alias for 'value' in @Header.

Issue: SPR-11393
2015-05-29 23:23:52 +02:00
Sam Brannen 35c3e7c0f3 Polishing 2015-05-29 23:10:25 +02:00
Sam Brannen 250787a35a Introduce alias for 'value' attribute in @Payload
This commit introduces 'expression' as an alias for 'value' in @Payload.

Issue: SPR-11393
2015-05-29 22:58:55 +02:00
Sam Brannen 7018747cec Remove trailing whitespace in Java source code 2015-05-29 02:03:44 +02:00
Juergen Hoeller 05d475a275 Polishing 2015-05-22 23:50:47 +02:00
Rossen Stoyanchev bbd3f902d0 Fix failing tests 2015-05-22 14:14:20 -04:00
Rossen Stoyanchev c48e8708a7 Fix NPE in DefaultSimpUserRegistry 2015-05-22 13:44:09 -04:00
Rossen Stoyanchev 92bd7bba50 Restore userSessionRegistry field in StompSubProtocolHandler
This change ensures that the deprecated UserSessionRegistry is still
used if configured.
2015-05-22 13:44:09 -04:00
Rossen Stoyanchev 0db216daab Polish 2015-05-22 09:06:18 -04:00
Sebastien Deleuze 5255e7ae21 Support CompletableFuture in @MessageMapping handler methods
Issue: SPR-12207
2015-05-22 11:30:56 +02:00
Sebastien Deleuze d3db99c201 Support ListenableFuture in @MessageMapping handler methods
This commit introduces support for asynchronous return values thanks
to the new AsyncHandlerMethodReturnValueHandler interface. Out of
the box support for ListenableFuture is also provided.

Issue: SPR-12168
2015-05-22 11:29:13 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Sebastien Deleuze 876c9694c4 Allow use of @JsonView on @MessageMapping methods
Issue: SPR-12741
2015-05-19 15:35:40 +02:00
Stephane Nicoll cf391f5ce1 polish
Remove unused imports
2015-05-19 08:49:01 +02:00
Rossen Stoyanchev 696a010e81 Add SubProtocolErrorHandler
Issue: SPR-12732
2015-05-15 18:18:05 -04:00
Juergen Hoeller 49c600b234 Resolved cyclic dependency between handler.invocation and handler.annotation
Issue: SPR-12696
2015-05-12 22:04:59 +02:00
Rossen Stoyanchev 281588d7bb Add SimpUserRegistry with multi-server support
This change introduces SimpUserRegistry exposing an API to access
information about connected users, their sessions, and subscriptions
with STOMP/WebSocket messaging. Provides are methods to access users
as well as a method to find subscriptions given a Matcher strategy.

The DefaultSimpUserRegistry implementation is also a
SmartApplicationListener which listesn for ApplicationContext events
when users connect, disconnect, subscribe, and unsubscribe to
destinations.

The MultiServerUserRegistry implementation is a composite that
aggregates user information from the local SimpUserRegistry as well
as snapshots of user  on remote application servers.

UserRegistryMessageHandler is used with MultiServerUserRegistry. It
broadcats user registry information through the broker and listens
for similar broadcasts from other servers. This must be enabled
explicitly when configuring the STOMP broker relay.

The existing UserSessionRegistry which was primiarly used internally
to resolve a user name to session id's has been deprecated and is no
longer used. If an application configures a custom UserSessionRegistr
still, it will be adapted accordingly to SimpUserRegistry but the
effect is rather limited (comparable to pre-existing functionality)
and will not work in multi-server scenarios.

Issue: SPR-12029
2015-05-12 15:29:12 -04:00
Rossen Stoyanchev eb9eadbb50 Polish 2015-05-07 12:01:54 -04:00
Arjen Poutsma a36319e91c Introduce Marshalling MessageConverter
This commit introduces a messaging.converter.MessageConverter that
marshals to/from XML using the abstractions provided in the OXM module.

Issue: SPR-12726
2015-05-07 12:01:54 -04:00
Juergen Hoeller 1cc042d4c7 Polishing 2015-05-07 16:03:15 +02:00
Sam Brannen 7a690df925 Remove trailing whitespace from Java source code 2015-05-06 20:08:42 +02:00
Rossen Stoyanchev 5538863dc9 Use shared eventLoopGroup in Reactor2TcpClient 2015-05-04 06:08:25 -04:00
Stephane Maldini 7891c0d5ca Update reactor2 support 2015-04-30 10:59:11 +02:00
Stephane Maldini 5ebc1a8b60 Update to latest reactor 2.0.1 snapshot 2015-04-30 10:59:00 +02:00
Rossen Stoyanchev 60b19c784d Update TCP/Reactor
Issue: SPR-12599
2015-04-24 07:19:04 -04:00
Stephane Maldini 74c0250525 Upgrade to Reactor 2
Issue: SPR-12599
2015-04-24 07:18:42 -04:00
Rossen Stoyanchev 16ee69203c Add support for destination vars in @SendTo/SendToUser
Issue: SPR-12170
2015-04-22 17:54:41 -04:00
Rossen Stoyanchev b6327acec8 Add SpEL based selector to DefaultSubscriptionRegistry
Issue: SPR-12884
2015-04-21 22:50:32 -04:00
Rossen Stoyanchev c29eae3307 Support user destinations with multiple app servers
This change adds support for broadcasting messages with unresolved
user destinations so that other servers can try to resolve it.
That enables sending messages to users who may be connected to a
different server.

Issue: SPR-11620
2015-04-17 11:55:44 -04:00
Rossen Stoyanchev c384945a17 Polish "user" destination support package
Issue: SPR-11620
2015-04-17 11:55:44 -04:00
Juergen Hoeller 10a51a4f19 InvocableHandlerMethod logs argument resolution exceptions at debug level
Issue: SPR-12925
2015-04-16 20:26:11 +02:00
Rossen Stoyanchev de9675bf5a Support heartbeat in SimpleBrokerMessageHandler
Issue: SPR-10954
2015-04-06 16:57:23 -04:00
Rossen Stoyanchev ae3417133b Add public access to PathMatcher in WebSocket config
Issue: SPR-12845
2015-03-26 16:50:33 -04:00
Juergen Hoeller d23893fd25 Consistent javadoc param declarations for type variables 2015-03-25 00:44:01 +01:00
Juergen Hoeller 4e28da439d TcpConnection extends java.io.Closeable
Issue: SPR-12849
2015-03-25 00:42:14 +01:00
Rossen Stoyanchev 4886edd10b Send STOMP ERROR if external broker not available
Issue: SPR-12820
2015-03-20 17:34:31 -04:00
Juergen Hoeller 898c24fcdd Optimized access to resolved bean type (avoiding BeanFactory locks)
Revised HandlerMethod.getBeanType() impl for both web and messaging.
In addition, HandlerMethods get created with the internal BeanFactory now.

Issue: SPR-12832
2015-03-20 17:35:44 +01:00
Rossen Stoyanchev 41e437066e Support @MessageExceptionHandler w/ @ControllerAdvice
This change adds support for global @MessageExceptionHandler methods
with STOMP over WebSocket messages. Such methods can be added to
@ControllerAdvice annotated components, much like @ExceptionHandler
methods for Spring MVC.

Issue: SPR-12696
2015-03-19 14:21:24 -04:00
Sam Brannen bf0703e07e Delete unused imports in spring-messaging 2015-03-17 17:29:38 +01:00
Rossen Stoyanchev d30b3eaf55 Add STOMP client
WebSocketStompClient can be used with any implementation of
org.springframework.web.socket.client.WebSocketClient, which includes
org.springframework.web.socket.sockjs.client.SockJsClient.

Reactor11TcpStompClient can be used with reactor-net and provides STOMP
over TCP. It's also possible to adapt other WebSocket and TCP client
libraries (see StompClientSupport for more details).

For example usage see WebSocketStompClientIntegrationTests.

Issue: SPR-11588
2015-03-12 21:48:29 -04:00
Juergen Hoeller dbd353bbd9 MessageHeaderAccessor defensively checks id, timestamp and contentType values
Issue: SPR-12730
2015-02-18 22:28:27 +01:00
Juergen Hoeller 8716129058 Revised MappingJackson2MessageConverter towards var-arg constructor
Issue: SPR-12724
2015-02-18 16:45:01 +01:00
Sebastien Deleuze 8159aa99a1 Add parametrized constructors to MappingJackson2MessageConverter
Issue: SPR-12724
2015-02-18 14:23:19 +01:00
Juergen Hoeller 058714b03a Polishing 2015-02-10 19:30:59 +01:00
Juergen Hoeller 7585be85f3 Revised validation javadoc, plus protected validate/isBindingErrorFatal template methods
Issue: SPR-12655
2015-02-10 19:28:30 +01:00
Stephane Nicoll f0fca890bb Annotation-based event listeners
Add support for annotation-based event listeners. Enabled automatically
when using Java configuration or can be enabled explicitly via the
regular <context:annotation-driven/> XML element. Detect methods of
managed beans annotated with @EventListener, either directly or through
a meta-annotation.

Annotated methods must define the event type they listen to as a single
parameter argument. Events are automatically filtered out according to
the method signature. When additional runtime filtering is required, one
can specify the `condition` attribute of the annotation that defines a
SpEL expression that should match to actually invoke the method for a
particular event. The root context exposes the actual `event`
(`#root.event`) and method arguments (`#root.args`). Individual method
arguments are also exposed via either the `a` or `p` alias (`#a0` refers
to the first method argument). Finally, methods arguments are exposed via
their names if that information can be discovered.

Events can be either an ApplicationEvent or any arbitrary payload. Such
payload is wrapped automatically in a PayloadApplicationEvent and managed
explicitly internally. As a result, users can now publish and listen
for arbitrary objects.

If an annotated method has a return value, an non null result is actually
published as a new event, something like:

@EventListener
public FooEvent handle(BarEvent event) { ... }

Events can be handled in an aynchronous manner by adding `@Async` to the
event method declaration and enabling such infrastructure. Events can
also be ordered by adding an `@Order` annotation to the event method.

Issue: SPR-11622
2015-02-10 09:13:02 +01:00
Rossen Stoyanchev f017cc3feb DefaultSubscriptionRegistry returns safe to iterate Map
Prior to this change when adding subscriptions
DefaultSubscriptionRegistry (incorrectly) made a copy of the given map
for its "access" cache rather than for its "update" cache.

Issue: SPR-12665
2015-02-02 13:52:12 -05:00
Rossen Stoyanchev 497944f0dd Fix minor test issues
Issue: SPR-12615
2015-01-20 17:14:20 -05:00
Rossen Stoyanchev 43d93712f1 Remove isStreaming flag from AbstractHttpSockJsSession
This change removes the need for the isStreaming field from the base
class AbstractHttpSockJsSession. This field was used to account for
differences between polling vs streaming SockJS sessions without having
to expose to sub-classes private fields that are otherwise protected
from concurrent access by the base class. The change manages to delegate
to sub-classes without providing direct access to protected fields.

Issue: SPR-12427
2015-01-12 14:48:09 -05:00
Rossen Stoyanchev f59fc83f30 Remove STOMP relay integration test
The test was verifying that when a DISCONNECT frame is sent to the
broker, there will be no further messages on the clientOutboundChannel.

This is generally true, however in some cases when the broker receives
a DISCONNECT it may close its connection fast enough (before we do) in
which case we send an ERROR message downstream to ensure the WebSocket
side is cleaned up. Either way the downstream should be idempotent
with regards to cleaning up sessions.
2015-01-06 09:52:06 -05:00
Juergen Hoeller 730bd02da7 Polishing 2014-12-30 15:01:51 +01:00
Juergen Hoeller bc075c713f Polishing 2014-12-29 20:34:18 +01:00
Juergen Hoeller ed0e2f4445 PayloadArgumentResolver does not insist on configured Validator anymore
Issue: SPR-12567
2014-12-29 12:55:37 +01:00
Sebastien Deleuze fbd85925de Use Jackson improved default configuration everywhere
With this commit, Jackson builder is now used in spring-websocket
to create the ObjectMapper instance.

It is not possible to use the builder for spring-messaging
and spring-jms since these modules don't have a dependency on
spring-web, thus they now just customize the same features:
 - MapperFeature#DEFAULT_VIEW_INCLUSION is disabled
 - DeserializationFeature#FAIL_ON_UNKNOWN_PROPERTIES is disabled

Issue: SPR-12293
2014-12-03 09:49:41 +01:00
Rossen Stoyanchev ed4cd9947f Add private method to remove duplication 2014-12-02 15:26:50 -05:00
Rossen Stoyanchev fa89ae244f Enrich CONNECTED frames with Principal
Issue: SPR-12479
2014-12-02 14:30:36 -05:00
Juergen Hoeller 2496d68e9f Relaxed final declarations and protected doInvoke methods
Issue: SPR-12484
2014-12-01 15:07:24 +01:00
Sebastien Deleuze 400738e804 Polish MessageHeaderAccessor
Issue: SPR-12431
2014-11-25 11:22:10 +01:00
Juergen Hoeller 929cda6790 Allow custom @Validated annotations for handler method parameters
Issue: SPR-12406
2014-11-24 23:34:24 +01:00
Juergen Hoeller 2675ce7c9f Polishing 2014-11-22 18:05:35 +01:00
Brian Clozel 75c70fac3d Fix user destination parsing in simp messaging
This commit fixes the parsing of message destinations such as
"/user/anna/queue/foo", reverting a regression introduced by SPR-11506,
which worked well with @SendToUser use cases but caused issues for
messages sent to other users.

Issue: SPR-12444
2014-11-21 15:23:32 +01:00
Juergen Hoeller a831ed524f Polishing 2014-11-11 03:09:29 +01:00
Juergen Hoeller 05bdc2cf77 Consistent declaration and use of UTF-8 Charset constants, plus related polishing 2014-11-11 02:38:30 +01:00
Sebastien Deleuze 18033486ae Check STOMP headers against ending backslash
Issue: SPR-12418
2014-11-10 17:12:08 +01:00
Juergen Hoeller a9c47df0c1 Polishing 2014-11-01 14:05:32 +01:00
Juergen Hoeller 1146d5ba1d Polishing 2014-10-29 22:44:59 +01:00
Rossen Stoyanchev da612d079f Replace "if(" with "if (" 2014-10-27 09:04:23 -04:00
Rossen Stoyanchev 01aa64c534 Simple broker sends notice after disconnect
Before this change the simple broker simply removed subscriptions
upon receiving a DISCONNECT message assuming it was a result of
a client STOMP WebSocket session ending.

However, if the server-side application sends a DISCONNECT to
the broker in order to terminate a session, the STOMP WebSocket
session could remain unware without any further action. This
change ensures the simple broker sends a DISCONNECT_ACK message
downstream whenever it receives a DISCONNECT.

Issue: SPR-12288
2014-10-24 09:48:18 -04:00
Rossen Stoyanchev 687955a704 Add ImmutableMessageChannelInterceptor
This change adds a ChannelInterceptor that flips the immutable flag on
messages being sent. This allows components sending messages to leave
the message mutable for interceptors to further apply modifications
before the message is sent (and exposed to concurrency).

The interceptor is automatically added with the STOMP/WebSocket Java
and XML config and the StompSubProtocolHandler leaves parsed incoming
messages mutable so they can be further modified before being sent.

Issue: SPR-12321
2014-10-23 15:25:51 -04:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Sam Brannen 9bc32ac199 Delete unused imports in spring-messaging module 2014-10-13 20:33:28 +02:00
Juergen Hoeller 473ed1a672 Polishing 2014-10-04 01:01:53 +02:00
Juergen Hoeller b6a3808a97 AbstractMessageChannel triggers afterSendCompletion with previously resolved non-null Message in case of preSend returning null
Issue: SPR-12295
2014-10-04 00:40:53 +02:00
Juergen Hoeller 44e29210cb ExecutorSubscribableChannel's SendTask actually returns local MessageHandler now
Issue: Issue: SPR-12272
2014-10-01 01:05:39 +02:00
Sam Brannen 7aa3cc9bb2 Clean up MessageBrokerConfigurationTests
- clean up warnings
 - simplify ApplicationContext configuration
2014-09-30 16:52:50 +02:00
Sam Brannen 5f4eb4dd55 Complete Javadoc for MessageHandlingRunnable 2014-09-30 15:30:15 +02:00
Rossen Stoyanchev 521bbfcf56 Allow configuring custom ThreadPoolTaskExecutor
Issue: SPR-12272
2014-09-29 23:02:40 -04:00
Rossen Stoyanchev 179b236608 Add MessageHandlingRunnable
Issue: SPR-12272
2014-09-29 22:41:09 -04:00
Rossen Stoyanchev 84137ab986 Polish ExecutorSubscribableChannel
Consolidate inner classes used to invoke a subscriber with
interceptors.
2014-09-29 22:23:45 -04:00
Rossen Stoyanchev ceb79c9bee Use InterceptableChannel in AbstractBrokerMessageHandler
Issue: SPR-12218
2014-09-26 13:25:52 -04:00
Rossen Stoyanchev 6f1ab8d02d Add InterceptableChannel
The new contract allows registration of interceptors with any
MessageChannel implementation hierarchy -- for example the one in the
Spring Framework or the one in Spring Integration.
2014-09-26 13:21:27 -04:00
Rossen Stoyanchev 6c57c3e4b5 Catch exception while clearing TCP conn to broker
When a DISCONNECT is sent to the broker, we proactively close the TCP
connection unless the DISCONNECT has a receipt header. Depending on
the timing, the broker may also close the connection on its side.
That appears to cause an exception in reactor on the CI server, e.g.:

https://build.spring.io/browse/SPR-PUB-JOB1-1715/test/case/135247530

This change traps the exceptions and prevents it from propagating.
2014-09-26 12:09:59 -04:00
Rossen Stoyanchev 371d93b346 Detect unsent DISCONNECT messages
This change uses a ChannelInterceptor (inserted at index 0) to detect
when a DISCONNECT message is precluded from being sent on the
clientInboundChannel. This can happen if another interceptor allows
a runtime exception out from preSend or returns false.

It is crucial for such messages to be processed, so when detected
they're processed still.

Issue: SPR-12218
2014-09-25 23:22:12 -04:00
Rossen Stoyanchev 1feeceb6de Move MessageChannel fields up to AbstractMessageBroker 2014-09-25 22:48:43 -04:00
Juergen Hoeller 3836aa051f Message broker thread pools should be set up in allowCoreThreadTimeOut mode
Issue: SPR-12249
2014-09-25 01:29:00 +02:00
Sam Brannen bf93f0c5e9 Clean up warnings in spring-messaging 2014-09-22 14:30:21 +02:00
Rossen Stoyanchev 237b50a9c8 Allow configuring custom argument types
The WebSocket messaging namespace now exposes configuration options for
custom argument resolvers and return value handlers.

Issue: SPR-12217
2014-09-19 16:47:39 -04:00
Juergen Hoeller 1e7bfd91a7 Polishing 2014-09-10 01:28:54 +02:00
Juergen Hoeller 5790fc904a Consistent support for java.util.Optional for all applicable handler method arguments
Issue: SPR-12171
2014-09-10 01:27:46 +02:00
Juergen Hoeller 86b7118da8 Polishing 2014-09-04 02:30:25 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Rossen Stoyanchev 96563c7eea Update Javadoc in SimpMessageSendingOperations
Issue: SPR-12143
2014-09-02 15:41:17 -04:00
Juergen Hoeller 820a160578 Polishing 2014-08-23 01:57:52 +02:00
Juergen Hoeller 078f23d6e6 Polishing 2014-08-23 01:07:01 +02:00
Juergen Hoeller b93dd95475 Polishing 2014-08-22 22:55:57 +02:00
Juergen Hoeller 28a966f544 MessageBuilder avoids intermediate HashMap for MessageHeaders building
Issue: SPR-11468
2014-08-22 22:55:48 +02:00
Phillip Webb ac8326d2df Polish mockito usage
Consistent use of BDDMockito rather than standard Mockito.
2014-08-11 16:23:11 -07:00
Juergen Hoeller c06ac06bdd JmsMessagingTemplate uses local convertJmsException template method instead of generic MessagingExceptionTranslator interface
This commit also turns MessagingException into a NestedRuntimeException subclass which delivers a root message that has the cause message appended to it. That's a common expectation with the use of Spring exceptions since all of our exception hierarchies have historically been designed that way.

Issue: SPR-12064
Issue: SPR-12038
2014-08-09 22:06:50 +02:00
Stephane Nicoll c1d149591a Add base header mapper implementation 2014-08-08 16:59:42 +02:00
Stephane Nicoll e010309530 Use @Payload on method declaration
Issue: SPR-12071
2014-08-07 15:09:04 +02:00
Stephane Nicoll 3da68cfe21 Remove unused imports 2014-08-04 14:13:40 +02:00
Stephane Nicoll 7d1e33d88d Move JmsHandlerMethodFactory to spring-messaging
This commit moves JmsHandlerMethodFactory and its default
implementation to the messaging abstraction. Working on a similar
support for AMQP revealed that this factory has nothing that is JMS
specific and is exactly identical in the case of AMQP.

Issue: SPR-12053
2014-08-01 16:08:31 +02:00
Juergen Hoeller 1fe742addf MessagingExceptionTranslator lives in support subpackage now
Issue: SPR-12038
2014-07-29 16:22:47 +02:00
Stephane Nicoll 89d63eb79b JmsMessagingTemplate exception management
This commit introduces MessagingExceptionTranslator, a messaging
exception translation infrastructure similar to what
PersistenceExceptionTranslator provides.

JmsMessagingTemplate does not throw raw JmsException anymore but
translates those to an instance of Spring's MessagingException
hierarchy.

Issue: SPR-12038
2014-07-29 12:29:43 +02:00
Juergen Hoeller 8cc0fa5ae1 Polishing 2014-07-28 22:05:40 +02:00
Juergen Hoeller 9fa4dad13c Polishing 2014-07-28 15:58:22 +02:00
Stephane Nicoll b6389a6c66 Jms request/reply operations
This commit updates JmsMessagingTemplate to support the
MessageRequestReplyOperation interface that provides synchronous
request/reply operations.

As JmsMessagingTemplate delegates everything under the scenes to
JmsTemplate, the latter has been updated as well to offer such lower
level operation.

Issue: SPR-12037
2014-07-28 15:52:50 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Juergen Hoeller 188e58c46a Fixed javadoc links 2014-07-18 17:21:44 +02:00
Rossen Stoyanchev 44e4569150 Polish 2014-07-17 09:24:45 -04:00
Sebastien Deleuze 59f39706dc Fix default target destination when using "." as path separator
Issue: SPR-11660
2014-07-17 09:01:45 -04:00
Rossen Stoyanchev e8d8c3390a Increase timeout in integration test 2014-07-16 22:05:50 -04:00
Sebastien Deleuze 86e8bdab6b Make ListenableFuture compliant with Java 8 lambda
Make it possible to use a ListenableFuture with Java 8
lambda expressions, using a syntax like
listenableFuture.addCallback(() -> ..., () -> ...);

Issue: SPR-11820
2014-07-16 16:06:24 +02:00
Rossen Stoyanchev ab2526a586 Update support for using "." as path separator
Issue: SPR-11660
2014-07-14 18:49:25 -04:00
Sebastien Deleuze 928a466b5d Allow to customize separator for messaging destinations
In order to be able to use separators like "." (used by default
by most broker relays) instead of "/" for destination patterns
handling, the PathMatcher used in spring-messaging can now
be customized easily thanks to XML websocket namespace
or JavaConfig.

AntPathMatcher has been updated in order to use the configured path
separator instead of an hardcoded "/" for path concatenation.
Extension handling is now disabled when the "." separator is configured.

Issue: SPR-11660
2014-07-14 18:49:24 -04:00
Rossen Stoyanchev b318880661 Ensure StompEncoder never writes content-length twice
Issue: SPR-11984
2014-07-11 10:09:48 -04:00
Rossen Stoyanchev 2f371e5aeb Add ExecutorChannelInterceptor
Issue: SPR-11968
2014-07-10 16:55:34 -04:00
Rossen Stoyanchev f8e4547228 Fix test class name and protect debug log message 2014-07-10 16:55:34 -04:00
Rossen Stoyanchev 670c216d38 Change converter ordering in message broker config
Issue: SPR-11961
2014-07-10 12:57:00 -04:00
Juergen Hoeller e254b558f0 Polishing 2014-07-10 18:38:07 +02:00
Rossen Stoyanchev eaad0a0f52 Add after completion callbacks to ChannelInterceptor
Issue: SPR-11966
2014-07-09 18:57:11 -04:00
Juergen Hoeller 6f062581a6 Removed unused import (which indicated a package cycle) 2014-07-10 00:36:54 +02:00
Juergen Hoeller 0d4ff1adbf Polishing 2014-07-09 22:25:35 +02:00
Juergen Hoeller fa4f51c5d0 Subpackage rearrangements within 4.1's jms-messaging alignment
Issue: SPR-10873
2014-07-09 22:19:14 +02:00
Juergen Hoeller 777085bbfc MappingJackson2JsonView/MessageConverter calls non-deprecated Jackson 2.1+ createGenerator API
Also removing workaround for https://github.com/FasterXML/jackson-databind/issues/12 (fixed in 2.1+)

Issue: SPR-11262
2014-07-09 21:23:09 +02:00
Rossen Stoyanchev 48236be4a2 STOMP and WebSocket messaging related logging updates
This change removes most logging at INFO level and also ensures the
amount of information logged at DEBUG level is useful, brief, and
not duplicated.

Also added is custom logging for STOMP frames to ensure very readable
and consise output.

Issue: SPR-11934
2014-07-09 00:39:59 -04:00
Rossen Stoyanchev ab4864da2a Add STOMP/WebSocket stats collection
This change adds collection of stats in key infrastructure components
of the WebSocket message broker config setup and exposes the gathered
information for logging and viewing (e.g. via JMX).

WebSocketMessageBrokerStats is a single class that assembles all
gathered information and by default logs it once every 15 minutes.
Application can also easily expose to JMX through an MBeanExporter.

A new section in the reference documentation provides a summary of
the available information.

Issue: SPR-11739
2014-07-09 00:39:47 -04:00
Juergen Hoeller 526b463474 Standard use of resolvedDestinationCache Map; fixed formatting
Issue: SPR-11939
2014-07-02 20:53:52 +02:00
Rossen Stoyanchev 6d15fcc4a6 Log name of test for WebSocket integration tests
This makes it easier to trace log output on the CI server where the
output is per class.
2014-07-02 14:26:51 -04:00
Juergen Hoeller 5614e257d1 Polishing
Issue: SPR-11939
2014-07-02 17:03:05 +02:00
Juergen Hoeller c84b30d4a4 CachingDestinationResolverProxy for slow target DestinationResolvers
Issue: SPR-11939
2014-07-02 17:00:26 +02:00
Rossen Stoyanchev 7a1f19b96c Polish 2014-07-01 14:24:16 -04:00
Sebastien Deleuze ce20abde51 Improve subscription removal in SubscriptionRegistry
Avoid using destination pattern based search when removing sessions or
subscriptions from DefaultSubscriptionRegistry and use only session and
subscription ids.

Issue: SPR-11930
2014-07-01 14:23:26 -04:00
Sebastien Deleuze 083d415fc4 Fix cache cleanup issue in DefaultSubscriptionRegistry
Issue: SPR-11931
2014-07-01 14:23:06 -04:00
Rossen Stoyanchev 7da3fb4ce6 Support STOMP DISCONNECT with receipt
Issue: SPR-11599
2014-06-29 13:15:22 -04:00
Rossen Stoyanchev 86de416908 More WebSocket logging updates
Update WebSocketSession toString methods to include the handshake URI
and add id and URI fields to ensure they're available after close().

Log WebSocket session open and close events at INFO.

Remove trace messages for destinations that do not match.

Issue: SPR-11884
2014-06-29 13:15:02 -04:00
Rossen Stoyanchev cab0b97a83 Polish 2014-06-27 12:43:52 -04:00
Rossen Stoyanchev 7a5b3c1eed Append suffx to user dest in SimpMessagingTemplate
Isssue: SPR-11868
2014-06-27 12:43:52 -04:00
Rossen Stoyanchev 113fd1180a Fine tune STOMP and WebSocket related logging
Optimize logging with tracking the opening and closing of WebSocket
sessions and STOMP broker connections in mind.

While the volume of messages makes it impractical to log every message
at anything higher than TRACE, the opening and closing of connections
is more manageable and can be logged at INFO. This makes it possible to
drop to INFO in production and get useful information without getting
too much in a short period of time.

The logging is also optimized to avoid providing the same information
from multiple places since messages pass through multiple layers.

Issue: SPR-11884
2014-06-27 04:06:06 -04:00
Juergen Hoeller 18131bf611 Consistent declaration of private static final logger variables
Issue: SPR-11905
2014-06-24 14:02:05 +02:00
Juergen Hoeller 5a8e470ede DefaultSubscriptionRegistry's removeSubscriptionInternal defensively handles non-existing destinations
Issue: SPR-11832
2014-06-04 22:48:34 +02:00
Stephane Nicoll e4ad9c5204 polishing
If no converter is found, the MessageConversionException now contains
the message instance that could not be handled

Issue: SPR-11817
2014-05-30 14:53:09 +02:00
Stephane Nicoll 12a9df8a1c Throw a proper exception if no convert is found
Prior to this commit, no exception was raised if a message could not
be converted to the requested payload because no suitable converter
were found.

This commit adds an explicit check if the converted payload is null.

Issue: SPR-11817
2014-05-28 16:48:48 +02:00
Stephane Nicoll 9fabcad3dd Revisit JmsMessagingTemplate
This commit revisits JmsMessagingTemplate and adds support for
receiving operations as well. JmsMessageSendingOperations has been
renamed to JmsMessageOperations.

The messaging abstraction did not split receiving and request-reply
operations. AbstractMessageReceivingTemplate has been created to hold
only the receiving operations.

Issue: SPR-11772
2014-05-26 09:35:03 +02:00
Stephane Nicoll 7469159bf1 Add MessageSendingOperations for JMS
This commit adds a JMS implementation of MessageSendingOperations,
allowing to send JMS messages using Spring's standard Messaging
abstraction.

MessagingMessageConverter is a standard JMS's MessageConverter that
can convert Spring's Message to JMS message and vice versa. Existing
infrastructure has been updated to use this implementation.

Issue: SPR-11772
2014-05-19 10:46:13 +02:00
Rossen Stoyanchev 673a497923 Await TcpClient shutdown in STOMP broker relay 2014-05-15 22:00:17 -04:00
Rossen Stoyanchev 2c4cbb617e Add WebSocket scope
This change adds support for a custom "websocket" scope.

WebSocket-scoped beans may be injected into controllers with message
handling methods as well as channel interceptor registered on the
"inboundClientChannel".

Issue: SPR-11305
2014-05-11 12:31:17 -04:00
Rossen Stoyanchev 97fb308b6b Allow use of @SendToUser even w/o authenticated user
Before this change, subscribing to a user destination and use of
@SendToUser annotation required an authenticated user.

This change makes it possible to subscribe to a user destination from
WebSocket sessions without an authenticated user. In such cases the
destination is associated with one session only rather than with a
user (and all their sessions).

It is then also possible to send a message to a user destination
via "/user/{sessionId}/.." rather than "/user/{user}/...".

That means @SendToUser works relying on the session id of the input
message, effectively sending a reply to destination private to the
session.

A key use case for this is handling an exception with an
@MessageExceptionHandler method and sending a reply with @SendToUser.

Issue: SPR-11309
2014-05-08 22:06:57 -04:00
Sebastien Deleuze 98738c0bbb Avoid ConcurrentModificationException
Removal of cached destination is now moved outside the for loop
that removes subscriptions to avoid ConcurrentModificationException.

Also since updateCache is a LinkedHashMap with accessOrder=true,
a simple access with updateCache.get() modify the map.
By iterating over updateCache.entrySet(), we avoid this update.

Issue: SPR-11755
2014-05-06 20:19:09 -04:00
Rossen Stoyanchev 9598a1e2ef Update @SendToUser and related code
Issue: SPR-11506
2014-05-01 10:35:35 -04:00
Mark Galea 088b80f4c5 Add singleSession attribute to @SendToUser
Added the ability to send a message only to one user session. Given a
user has two tabs open and the client sends a message to the server
from tab 1, it is now possible to send a reply message to only 1 tab
instead of the default mode of targetting all known user sessions.

Issue: SPR-11506
2014-05-01 10:33:14 -04:00
Rossen Stoyanchev 5dcd55b23b Log ignored CONNECT messages at error level
Issue: SPR-11673
2014-04-30 11:11:43 -04:00
Rossen Stoyanchev d52f07aa1b Log STOMP ERROR frames at error level
Issue: SPR-11673
2014-04-30 11:00:27 -04:00
Rossen Stoyanchev 1958ae3a62 Update log level
Issue: SPR-11673
2014-04-30 10:26:51 -04:00
Rossen Stoyanchev 6a9b229249 Split destination cache into access vs update
Issue: SPR-11657
2014-04-29 22:15:18 -04:00
Rossen Stoyanchev c879796e00 Add cache limit to DefaultSessionRegistry and polish
Issue: SPR-11657
2014-04-29 18:16:09 -04:00
Sebastien Deleuze 1054080b24 Fix DefaultSubscriptionRegistry when using pattern destinations
DestinationCache is now used for both plain and pattern
destinations. It stores internally the subscriptions map for each
cached destination. Subscriptions are initially created when there
is no cache for the requested destination, and are updated when
subscriptions change.

Issue: SPR-11657
2014-04-29 18:16:09 -04:00
Rossen Stoyanchev 58adc150c9 Fix STOMP broker relay int test issue
Avoid dependency on order in which expected messages are received.
2014-04-29 17:17:10 -04:00
Rossen Stoyanchev 56d26443e2 Fix one more issue in STOMP broker relay int test 2014-04-29 16:36:43 -04:00
Rossen Stoyanchev 13be6d2321 Fix issue in STOMP broker relay integration test 2014-04-29 15:48:39 -04:00
Rossen Stoyanchev 01fe2923ee Simplify STOMP broker relay integration test
This change simplifies the implementation of the "test" EventPublisher
and MessageHandler used in the STOMP broker relay integration tests.
The updated implementations use a time-limted poll on a BlockingQueue.
2014-04-29 13:22:23 -04:00
Rossen Stoyanchev 1200755125 Fix issue with subscribe destination
The original fix for SPR-11423:
32e5f57e64

was insufficient when using an external broker since the original
destination header has to be in the "native headers" map (i.e. with
STOMP headers) in order to be included in messages broadcast by
the broker.
2014-04-25 12:26:04 -04:00
Stephane Nicoll bded025d9f @SendTo support for jms listener endpoints
This commit replaces the "responseDestination" attribute on the
JmsListener annotation by a support of the standard SendTo annotation.

Issue: SPR-11707
2014-04-24 15:33:24 +03:00
Rossen Stoyanchev 08f0395033 Rename Reactor support classes
This change modifies the names of the Reactor support classes in order
to align with the same changes in the 4.0.x line which now supports
both Reactor 1.1 and 1.0.

Issue: SPR-11636
2014-04-23 23:46:43 -04:00
Stephane Nicoll 5559209233 Remove useless imports 2014-04-22 09:57:12 +02:00
Philippe Marschall eb5f397a39 Clean up spring-messaging imports
spring-messaging is full of unused imports. This commit removes all
unused imports from spring-messaging.
2014-04-22 07:28:10 +02:00
Juergen Hoeller 086f1eda71 Polishing 2014-04-17 22:39:47 +02:00