/** * Set the PathMatcher implementation to use for matching destinations * against configured destination patterns. * <p>By default, {@link AntPathMatcher} is used. */ public void setPathMatcher(PathMatcher pathMatcher) { Assert.notNull(pathMatcher, "PathMatcher must not be null"); this.pathMatcher = pathMatcher; this.slashPathSeparator = this.pathMatcher.combine("a", "a").equals("a/a"); }
public String combine(String pattern1, String pattern2) { return delegate.combine(pattern1, pattern2); }
private static Set<String> prependLeadingSlash(Collection<String> patterns, PathMatcher pathMatcher) { boolean slashSeparator = pathMatcher.combine("a", "a").equals("a/a"); Set<String> result = new LinkedHashSet<>(patterns.size()); for (String pattern : patterns) { if (slashSeparator && StringUtils.hasLength(pattern) && !pattern.startsWith("/")) { pattern = "/" + pattern; } result.add(pattern); } return result; }
public String combine(String pattern1, String pattern2) { return delegate.combine(pattern1, pattern2); }
for (String pattern1 : this.patterns) { for (String pattern2 : other.patterns) { result.add(this.pathMatcher.combine(pattern1, pattern2));
for (String pattern1 : this.patterns) { for (String pattern2 : other.patterns) { result.add(this.pathMatcher.combine(pattern1, pattern2));
for (String pattern1 : this.patterns) { for (String pattern2 : other.patterns) { result.add(this.pathMatcher.combine(pattern1, pattern2));
private static UriComponentsBuilder fromMethodInternal(@Nullable UriComponentsBuilder builder, Class<?> controllerType, Method method, Object... args) { builder = getBaseUrlToUse(builder); // Externally configured prefix via PathConfigurer.. String prefix = getPathPrefix(controllerType); builder.path(prefix); String typePath = getClassMapping(controllerType); String methodPath = getMethodMapping(method); String path = pathMatcher.combine(typePath, methodPath); builder.path(path); return applyContributors(builder, method, args); }
@Test public void customPathMatcher() { ApplicationContext context = loadConfig(CustomConfig.class); SimpleBrokerMessageHandler broker = context.getBean(SimpleBrokerMessageHandler.class); DefaultSubscriptionRegistry registry = (DefaultSubscriptionRegistry) broker.getSubscriptionRegistry(); assertEquals("a.a", registry.getPathMatcher().combine("a", "a")); PathMatcher pathMatcher = context.getBean(SimpAnnotationMethodMessageHandler.class).getPathMatcher(); assertEquals("a.a", pathMatcher.combine("a", "a")); DefaultUserDestinationResolver resolver = context.getBean(DefaultUserDestinationResolver.class); assertNotNull(resolver); assertEquals(false, resolver.isRemoveLeadingSlash()); }
private static UriComponentsBuilder fromMethodInternal(@Nullable UriComponentsBuilder builder, Class<?> controllerType, Method method, Object... args) { builder = getBaseUrlToUse(builder); // Externally configured prefix via PathConfigurer.. String prefix = getPathPrefix(controllerType); builder.path(prefix); String typePath = getClassMapping(controllerType); String methodPath = getMethodMapping(method); String path = pathMatcher.combine(typePath, methodPath); builder.path(path); return applyContributors(builder, method, args); }
private static UriComponentsBuilder fromMethodInternal(UriComponentsBuilder baseUrl, Class<?> controllerType, Method method, Object... args) { baseUrl = getBaseUrlToUse(baseUrl); String typePath = getTypeRequestMapping(controllerType); String methodPath = getMethodRequestMapping(method); String path = pathMatcher.combine(typePath, methodPath); baseUrl.path(path); UriComponents uriComponents = applyContributors(baseUrl, method, args); return UriComponentsBuilder.newInstance().uriComponents(uriComponents); }
public String combine(String pattern1, String pattern2) { return delegate.combine(pattern1, pattern2); }
public String combine(String pattern1, String pattern2) { return delegate.combine(pattern1, pattern2); }
/** * Set the PathMatcher implementation to use for matching destinations * against configured destination patterns. * <p>By default, {@link AntPathMatcher} is used. */ public void setPathMatcher(PathMatcher pathMatcher) { Assert.notNull(pathMatcher, "PathMatcher must not be null"); this.pathMatcher = pathMatcher; this.slashPathSeparator = this.pathMatcher.combine("a", "a").equals("a/a"); }
private static Set<String> prependLeadingSlash(Collection<String> patterns, PathMatcher pathMatcher) { boolean slashSeparator = pathMatcher.combine("a", "a").equals("a/a"); Set<String> result = new LinkedHashSet<>(patterns.size()); for (String pattern : patterns) { if (slashSeparator && StringUtils.hasLength(pattern) && !pattern.startsWith("/")) { pattern = "/" + pattern; } result.add(pattern); } return result; }
for (String pattern1 : this.patterns) { for (String pattern2 : other.patterns) { result.add(this.pathMatcher.combine(pattern1, pattern2));
@Override public String combine(String pattern1, String pattern2) { return delagateMatcher.combine(pattern1, pattern2); } }
return target.combine(pattern1, pattern2);
/** * Set the PathMatcher implementation to use for matching destinations * against configured destination patterns. * <p>By default, {@link AntPathMatcher} is used. */ public void setPathMatcher(PathMatcher pathMatcher) { Assert.notNull(pathMatcher, "PathMatcher must not be null"); this.pathMatcher = pathMatcher; this.slashPathSeparator = this.pathMatcher.combine("a", "a").equals("a/a"); }
private static UriComponentsBuilder fromMethodInternal(UriComponentsBuilder baseUrl, Class<?> controllerType, Method method, Object... args) { baseUrl = getBaseUrlToUse(baseUrl); String typePath = getTypeRequestMapping(controllerType); String methodPath = getMethodRequestMapping(method); String path = pathMatcher.combine(typePath, methodPath); baseUrl.path(path); UriComponents uriComponents = applyContributors(baseUrl, method, args); return UriComponentsBuilder.newInstance().uriComponents(uriComponents); }