Search in sources :

Example 1 with RouteMatcher

use of org.springframework.util.RouteMatcher in project spring-framework by spring-projects.

the class MessageMappingMessageHandler method obtainRouteMatcher.

/**
 * Obtain the {@code RouteMatcher} for actual use.
 * @return the RouteMatcher (never {@code null})
 * @throws IllegalStateException in case of no RouteMatcher set
 * @since 5.0
 */
protected RouteMatcher obtainRouteMatcher() {
    RouteMatcher routeMatcher = getRouteMatcher();
    Assert.state(routeMatcher != null, "No RouteMatcher set");
    return routeMatcher;
}
Also used : RouteMatcher(org.springframework.util.RouteMatcher) SimpleRouteMatcher(org.springframework.util.SimpleRouteMatcher)

Example 2 with RouteMatcher

use of org.springframework.util.RouteMatcher in project spring-framework by spring-projects.

the class RSocketMessageHandlerTests method testHandleNoMatch.

private static void testHandleNoMatch(FrameType frameType) {
    RSocketMessageHandler handler = new RSocketMessageHandler();
    handler.setDecoders(Collections.singletonList(StringDecoder.allMimeTypes()));
    handler.setEncoders(Collections.singletonList(CharSequenceEncoder.allMimeTypes()));
    handler.afterPropertiesSet();
    RouteMatcher matcher = new SimpleRouteMatcher(new AntPathMatcher("."));
    RouteMatcher.Route route = matcher.parseRoute("path");
    MessageHeaderAccessor headers = new MessageHeaderAccessor();
    headers.setHeader(RSocketFrameTypeMessageCondition.FRAME_TYPE_HEADER, frameType);
    Message<Object> message = MessageBuilder.createMessage("", headers.getMessageHeaders());
    handler.handleNoMatch(route, message);
}
Also used : RouteMatcher(org.springframework.util.RouteMatcher) SimpleRouteMatcher(org.springframework.util.SimpleRouteMatcher) MessageHeaderAccessor(org.springframework.messaging.support.MessageHeaderAccessor) SimpleRouteMatcher(org.springframework.util.SimpleRouteMatcher) AntPathMatcher(org.springframework.util.AntPathMatcher)

Aggregations

RouteMatcher (org.springframework.util.RouteMatcher)2 SimpleRouteMatcher (org.springframework.util.SimpleRouteMatcher)2 MessageHeaderAccessor (org.springframework.messaging.support.MessageHeaderAccessor)1 AntPathMatcher (org.springframework.util.AntPathMatcher)1