AbstractMethodMessageHandler for reactive, non-blocking
handling of messages via @MessageMapping methods.
By default, such methods are detected in @Controller Spring beans but
that can be changed via setHandlerPredicate(Predicate).
Payloads for incoming messages are decoded through the configured
setDecoders(List) decoders, with the help of
PayloadMethodArgumentResolver.
There is no default handling for return values but
setReturnValueHandlerConfigurer can be used to configure custom
return value handlers. Subclasses may also override
initReturnValueHandlers() to set up default return value handlers.
AbstractEncoderMethodReturnValueHandler
| Modifier and Type | Field and Description |
|---|---|
| private ConversionService | |
| private final List | |
| private RouteMatcher | |
| private Validator | |
| private StringValueResolver |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| protected AbstractExceptionHandlerMethodResolver | createExceptionMethodResolverFor(Class<?>
the class in which an exception occurred during handling beanType)Implements abstract org. Create a concrete instance of |
| protected CompositeMessageCondition | Returns: the condition, ornullthe element to check element)Determine the mapping condition for the given annotated element. |
| public ConversionService | |
| public List | |
| protected RouteMatcher. | getDestination(Message<?> message)
Implements abstract org. Extract the destination from the given message. |
| protected Set | getDirectLookupMappings(CompositeMessageCondition mapping)
Implements abstract org. Return String-based destinations for the given mapping, if any, that can be used to find matches with a direct lookup (i.e. non-patterns). |
| protected Comparator | getMappingComparator(Message<?>
the current Message message)Implements abstract org. Return a comparator for sorting matching mappings. |
| protected CompositeMessageCondition | getMappingForMethod(Method
the method to check method, Class<?> the handler type, possibly a subtype of the method's declaring class handlerType)Implements abstract org. Obtain the mapping for the given method, if any. |
| protected CompositeMessageCondition | getMatchingMapping(CompositeMessageCondition
the mapping to get a match for mapping, Message<?> the message being handled message)Implements abstract org. Check if a mapping matches the current message and return a possibly new mapping with conditions relevant to the current request. |
| public RouteMatcher | |
| public Validator | |
| protected Mono | handleMatch(CompositeMessageCondition mapping, HandlerMethod handlerMethod, Message<?> message)
Overrides org.
|
| protected List | initArgumentResolvers()
Implements abstract org. Return the list of argument resolvers to use. |
| protected List | initReturnValueHandlers()
Implements abstract org. Return the list of return value handlers to use. |
| protected RouteMatcher | |
| protected String[] | Returns: new array with the processed destinations or the same arraythe destinations destinations)Resolve placeholders in the given destinations. |
| public void | registerMessagingAdvice(MessagingAdviceBean
the bean to check for bean)@MessageExceptionHandler methodsUse this method to register a |
| public void | setConversionService(ConversionService
the conversion service to use conversionService)Configure a |
| public void | setDecoders(List<? extends Decoder<?>> decoders)
Configure the decoders to use for incoming payloads. |
| public void | setEmbeddedValueResolver(StringValueResolver resolver)
Implements org. Set the StringValueResolver to use for resolving embedded definition values. |
| public void | setRouteMatcher(RouteMatcher routeMatcher)
Set the |
| public void |
| conversionService | back to summary |
|---|---|
| private ConversionService conversionService | |
| decoders | back to summary |
|---|---|
| private final List<Decoder<?>> decoders | |
| routeMatcher | back to summary |
|---|---|
| private RouteMatcher routeMatcher
| |
| validator | back to summary |
|---|---|
| private Validator validator
| |
| valueResolver | back to summary |
|---|---|
| private StringValueResolver valueResolver
| |
| MessageMappingMessageHandler | back to summary |
|---|---|
| public MessageMappingMessageHandler() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| createExceptionMethodResolverFor | back to summary |
|---|---|
| protected AbstractExceptionHandlerMethodResolver createExceptionMethodResolverFor(Class<?> beanType) Implements abstract org. Create a concrete instance of
| |
| getCondition | back to summary |
|---|---|
| protected CompositeMessageCondition getCondition(AnnotatedElement element) Determine the mapping condition for the given annotated element.
| |
| getConversionService | back to summary |
|---|---|
| public ConversionService getConversionService() Return the configured ConversionService. | |
| getDecoders | back to summary |
|---|---|
| public List Return the configured decoders. | |
| getDestination | back to summary |
|---|---|
| protected RouteMatcher. Implements abstract org. Extract the destination from the given message.
| |
| getDirectLookupMappings | back to summary |
|---|---|
| protected Set Implements abstract org. Return String-based destinations for the given mapping, if any, that can be used to find matches with a direct lookup (i.e. non-patterns). Note This is completely optional. The mapping metadata for a subclass may support neither direct lookups, nor String based destinations.
| |
| getMappingComparator | back to summary |
|---|---|
| protected Comparator Implements abstract org. Return a comparator for sorting matching mappings. The returned comparator should sort 'better' matches higher.
| |
| getMappingForMethod | back to summary |
|---|---|
| protected CompositeMessageCondition getMappingForMethod(Method method, Class<?> handlerType) Implements abstract org. Obtain the mapping for the given method, if any.
| |
| getMatchingMapping | back to summary |
|---|---|
| protected CompositeMessageCondition getMatchingMapping(CompositeMessageCondition mapping, Message<?> message) Implements abstract org. Check if a mapping matches the current message and return a possibly new mapping with conditions relevant to the current request.
| |
| getRouteMatcher | back to summary |
|---|---|
| public RouteMatcher getRouteMatcher() Return the
| |
| getValidator | back to summary |
|---|---|
| public Validator getValidator() Return the configured Validator instance.
| |
| handleMatch | back to summary |
|---|---|
| protected Mono Overrides org.
| |
| initArgumentResolvers | back to summary |
|---|---|
| protected List Implements abstract org. Return the list of argument resolvers to use. Subclasses should also take into account custom argument types configured via
| |
| initReturnValueHandlers | back to summary |
|---|---|
| protected List Implements abstract org. Return the list of return value handlers to use. Subclasses should also take into account custom return value types configured
via
| |
| obtainRouteMatcher | back to summary |
|---|---|
| protected RouteMatcher obtainRouteMatcher() Obtain the
| |
| processDestinations | back to summary |
|---|---|
| protected String[] processDestinations(String[] destinations) Resolve placeholders in the given destinations. | |
| registerMessagingAdvice | back to summary |
|---|---|
| public void registerMessagingAdvice(MessagingAdviceBean bean) Use this method to register a Note spring-messaging does not depend on spring-web and therefore it
is not possible to explicitly support the registration of a
ControllerAdviceBean.findAnnotatedBeans(context).forEach(bean ->
messageHandler.registerMessagingAdvice(new ControllerAdviceWrapper(bean));
public class ControllerAdviceWrapper implements MessagingAdviceBean {
private final ControllerAdviceBean delegate;
// delegate all methods
}
| |
| setConversionService | back to summary |
|---|---|
| public void setConversionService(ConversionService conversionService) Configure a By default
| |
| setDecoders | back to summary |
|---|---|
| public void setDecoders(List<? extends Decoder<?>> decoders) Configure the decoders to use for incoming payloads. | |
| setEmbeddedValueResolver | back to summary |
|---|---|
| public void setEmbeddedValueResolver(StringValueResolver resolver) Implements org. Doc from org. Set the StringValueResolver to use for resolving embedded definition values.
| |
| setRouteMatcher | back to summary |
|---|---|
| public void setRouteMatcher(RouteMatcher routeMatcher) Set the By default, | |
| setValidator | back to summary |
|---|---|
| public void setValidator(Validator validator) Set the Validator instance used for validating | |