Example usage for org.springframework.messaging.handler.annotation.support DestinationVariableMethodArgumentResolver DESTINATION_TEMPLATE_VARIABLES_HEADER

List of usage examples for org.springframework.messaging.handler.annotation.support DestinationVariableMethodArgumentResolver DESTINATION_TEMPLATE_VARIABLES_HEADER

Introduction

In this page you can find the example usage for org.springframework.messaging.handler.annotation.support DestinationVariableMethodArgumentResolver DESTINATION_TEMPLATE_VARIABLES_HEADER.

Prototype

String DESTINATION_TEMPLATE_VARIABLES_HEADER

To view the source code for org.springframework.messaging.handler.annotation.support DestinationVariableMethodArgumentResolver DESTINATION_TEMPLATE_VARIABLES_HEADER.

Click Source Link

Document

The name of the header used to for template variables.

Usage

From source file:ch.rasc.wampspring.message.WampMessage.java

public void setDestinationTemplateVariables(Map<String, String> vars) {
    this.messageHeaders.getRawHeaders()
            .put(DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER, vars);
}

From source file:org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler.java

@Override
protected void handleMatch(SimpMessageMappingInfo mapping, HandlerMethod handlerMethod,
        String lookupDestination, Message<?> message) {

    Set<String> patterns = mapping.getDestinationConditions().getPatterns();
    if (!CollectionUtils.isEmpty(patterns)) {
        String pattern = patterns.iterator().next();
        Map<String, String> vars = getPathMatcher().extractUriTemplateVariables(pattern, lookupDestination);
        if (!CollectionUtils.isEmpty(vars)) {
            MessageHeaderAccessor mha = MessageHeaderAccessor.getAccessor(message, MessageHeaderAccessor.class);
            Assert.state(mha != null && mha.isMutable(), "Mutable MessageHeaderAccessor required");
            mha.setHeader(DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER,
                    vars);/*from  w w  w.  j a v  a2s.  co m*/
        }
    }

    try {
        SimpAttributesContextHolder.setAttributesFromMessage(message);
        super.handleMatch(mapping, handlerMethod, lookupDestination, message);
    } finally {
        SimpAttributesContextHolder.resetAttributes();
    }
}