parent
fa4202f1bd
commit
1901cc65fd
|
@ -20,12 +20,12 @@ import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.util.AntPathMatcher;
|
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.PathMatcher;
|
import org.springframework.util.PathMatcher;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
import org.springframework.web.server.support.HttpRequestPathHelper;
|
import org.springframework.web.server.support.HttpRequestPathHelper;
|
||||||
|
import org.springframework.web.util.ParsingPathMatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a per reactive request {@link CorsConfiguration} instance based on a
|
* Provide a per reactive request {@link CorsConfiguration} instance based on a
|
||||||
|
@ -41,15 +41,15 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
|
||||||
|
|
||||||
private final Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<>();
|
private final Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<>();
|
||||||
|
|
||||||
private PathMatcher pathMatcher = new AntPathMatcher();
|
private PathMatcher pathMatcher = new ParsingPathMatcher();
|
||||||
|
|
||||||
private HttpRequestPathHelper pathHelper = new HttpRequestPathHelper();
|
private HttpRequestPathHelper pathHelper = new HttpRequestPathHelper();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the PathMatcher implementation to use for matching URL paths
|
* Set the PathMatcher implementation to use for matching URL paths
|
||||||
* against registered URL patterns. Default is AntPathMatcher.
|
* against registered URL patterns. Default is ParsingPathMatcher.
|
||||||
* @see AntPathMatcher
|
* @see ParsingPathMatcher
|
||||||
*/
|
*/
|
||||||
public void setPathMatcher(PathMatcher pathMatcher) {
|
public void setPathMatcher(PathMatcher pathMatcher) {
|
||||||
Assert.notNull(pathMatcher, "PathMatcher must not be null");
|
Assert.notNull(pathMatcher, "PathMatcher must not be null");
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class PathMatchConfigurer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the PathMatcher for matching URL paths against registered URL patterns.
|
* Set the PathMatcher for matching URL paths against registered URL patterns.
|
||||||
* <p>Default is {@link org.springframework.util.AntPathMatcher AntPathMatcher}.
|
* <p>Default is {@link org.springframework.web.util.ParsingPathMatcher ParsingPathMatcher}.
|
||||||
*/
|
*/
|
||||||
public PathMatchConfigurer setPathMatcher(PathMatcher pathMatcher) {
|
public PathMatchConfigurer setPathMatcher(PathMatcher pathMatcher) {
|
||||||
this.pathMatcher = pathMatcher;
|
this.pathMatcher = pathMatcher;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class ResourceHandlerRegistry {
|
||||||
* that matches to one of the specified path patterns.
|
* that matches to one of the specified path patterns.
|
||||||
*
|
*
|
||||||
* <p>Patterns like {@code "/static/**"} or {@code "/css/{filename:\\w+\\.css}"}
|
* <p>Patterns like {@code "/static/**"} or {@code "/css/{filename:\\w+\\.css}"}
|
||||||
* are allowed. See {@link org.springframework.util.AntPathMatcher} for more
|
* are allowed. See {@link org.springframework.web.util.ParsingPathMatcher} for more
|
||||||
* details on the syntax.
|
* details on the syntax.
|
||||||
* @return A {@link ResourceHandlerRegistration} to use to further
|
* @return A {@link ResourceHandlerRegistration} to use to further
|
||||||
* configure the registered resource handler
|
* configure the registered resource handler
|
||||||
|
|
|
@ -104,7 +104,7 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im
|
||||||
/**
|
/**
|
||||||
* Set the PathMatcher implementation to use for matching URL paths
|
* Set the PathMatcher implementation to use for matching URL paths
|
||||||
* against registered URL patterns. Default is AntPathMatcher.
|
* against registered URL patterns. Default is AntPathMatcher.
|
||||||
* @see org.springframework.util.AntPathMatcher
|
* @see org.springframework.web.util.ParsingPathMatcher
|
||||||
*/
|
*/
|
||||||
public void setPathMatcher(PathMatcher pathMatcher) {
|
public void setPathMatcher(PathMatcher pathMatcher) {
|
||||||
Assert.notNull(pathMatcher, "PathMatcher must not be null");
|
Assert.notNull(pathMatcher, "PathMatcher must not be null");
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||||
* various Ant-style pattern matches, e.g. a registered "/t*" pattern matches
|
* various Ant-style pattern matches, e.g. a registered "/t*" pattern matches
|
||||||
* both "/test" and "/team", "/test/*" matches all paths under "/test",
|
* both "/test" and "/team", "/test/*" matches all paths under "/test",
|
||||||
* "/test/**" matches all paths below "/test". For details, see the
|
* "/test/**" matches all paths below "/test". For details, see the
|
||||||
* {@link org.springframework.util.AntPathMatcher AntPathMatcher} javadoc.
|
* {@link org.springframework.web.util.ParsingPathMatcher ParsingPathMatcher} javadoc.
|
||||||
*
|
*
|
||||||
* <p>Will search all path patterns to find the most exact match for the
|
* <p>Will search all path patterns to find the most exact match for the
|
||||||
* current request path. The most exact match is defined as the longest
|
* current request path. The most exact match is defined as the longest
|
||||||
|
@ -130,7 +130,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping {
|
||||||
* @param urlPath URL the bean is mapped to
|
* @param urlPath URL the bean is mapped to
|
||||||
* @param exchange the current exchange
|
* @param exchange the current exchange
|
||||||
* @return the associated handler instance, or {@code null} if not found
|
* @return the associated handler instance, or {@code null} if not found
|
||||||
* @see org.springframework.util.AntPathMatcher
|
* @see org.springframework.web.util.ParsingPathMatcher
|
||||||
*/
|
*/
|
||||||
protected Object lookupHandler(String urlPath, ServerWebExchange exchange) throws Exception {
|
protected Object lookupHandler(String urlPath, ServerWebExchange exchange) throws Exception {
|
||||||
// Direct match?
|
// Direct match?
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.springframework.util.CollectionUtils;
|
||||||
* various Ant-style pattern matches, e.g. a registered "/t*" pattern matches
|
* various Ant-style pattern matches, e.g. a registered "/t*" pattern matches
|
||||||
* both "/test" and "/team", "/test/*" matches all paths under "/test",
|
* both "/test" and "/team", "/test/*" matches all paths under "/test",
|
||||||
* "/test/**" matches all paths below "/test". For details, see the
|
* "/test/**" matches all paths below "/test". For details, see the
|
||||||
* {@link org.springframework.util.AntPathMatcher AntPathMatcher} javadoc.
|
* {@link org.springframework.web.util.ParsingPathMatcher ParsingPathMatcher} javadoc.
|
||||||
*
|
*
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
|
@ -60,7 +60,7 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
|
||||||
* Map URL paths to handler bean names.
|
* Map URL paths to handler bean names.
|
||||||
* This is the typical way of configuring this HandlerMapping.
|
* This is the typical way of configuring this HandlerMapping.
|
||||||
* <p>Supports direct URL matches and Ant-style pattern matches. For syntax
|
* <p>Supports direct URL matches and Ant-style pattern matches. For syntax
|
||||||
* details, see the {@link org.springframework.util.AntPathMatcher} javadoc.
|
* details, see the {@link org.springframework.web.util.ParsingPathMatcher} javadoc.
|
||||||
* @param mappings properties with URLs as keys and bean names as values
|
* @param mappings properties with URLs as keys and bean names as values
|
||||||
* @see #setUrlMap
|
* @see #setUrlMap
|
||||||
*/
|
*/
|
||||||
|
@ -72,7 +72,7 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
|
||||||
* Set a Map with URL paths as keys and handler beans (or handler bean names)
|
* Set a Map with URL paths as keys and handler beans (or handler bean names)
|
||||||
* as values. Convenient for population with bean references.
|
* as values. Convenient for population with bean references.
|
||||||
* <p>Supports direct URL matches and Ant-style pattern matches. For syntax
|
* <p>Supports direct URL matches and Ant-style pattern matches. For syntax
|
||||||
* details, see the {@link org.springframework.util.AntPathMatcher} javadoc.
|
* details, see the {@link org.springframework.web.util.ParsingPathMatcher} javadoc.
|
||||||
* @param urlMap map with URLs as keys and beans as values
|
* @param urlMap map with URLs as keys and beans as values
|
||||||
* @see #setMappings
|
* @see #setMappings
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue