/** * Set the PathMatcher implementation to use for matching URL paths * against registered URL patterns. Default is AntPathMatcher. * @see org.springframework.util.AntPathMatcher */ public void setPathMatcher(PathMatcher pathMatcher) { Assert.notNull(pathMatcher, "PathMatcher must not be null"); this.pathMatcher = pathMatcher; if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) { ((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setPathMatcher(pathMatcher); } }
/** * Set the PathMatcher implementation to use for matching URL paths * against registered URL patterns. Default is AntPathMatcher. * @see org.springframework.util.AntPathMatcher */ public void setPathMatcher(PathMatcher pathMatcher) { Assert.notNull(pathMatcher, "PathMatcher must not be null"); this.pathMatcher = pathMatcher; if (this.corsConfigurationSource instanceof UrlBasedCorsConfigurationSource) { ((UrlBasedCorsConfigurationSource)this.corsConfigurationSource).setPathMatcher(pathMatcher); } }
/** * Set the "global" CORS configurations based on URL patterns. By default the first * matching URL pattern is combined with the CORS configuration for the handler, if any. * @since 4.2 * @see #setCorsConfigurationSource(CorsConfigurationSource) */ public void setCorsConfigurations(Map<String, CorsConfiguration> corsConfigurations) { Assert.notNull(corsConfigurations, "corsConfigurations must not be null"); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.setCorsConfigurations(corsConfigurations); source.setPathMatcher(this.pathMatcher); source.setUrlPathHelper(this.urlPathHelper); this.corsConfigurationSource = source; }
/** * Set the "global" CORS configurations based on URL patterns. By default the first * matching URL pattern is combined with the CORS configuration for the handler, if any. * @since 4.2 * @see #setCorsConfigurationSource(CorsConfigurationSource) */ public void setCorsConfigurations(Map<String, CorsConfiguration> corsConfigurations) { Assert.notNull(corsConfigurations, "corsConfigurations must not be null"); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.setCorsConfigurations(corsConfigurations); source.setPathMatcher(this.pathMatcher); source.setUrlPathHelper(this.urlPathHelper); this.corsConfigurationSource = source; }