adds host() moves PATTERN_KEY up
This commit is contained in:
@@ -19,7 +19,7 @@ package org.springframework.cloud.gateway.handler.predicate;
|
||||
|
||||
import org.springframework.web.reactive.function.server.RequestPredicate;
|
||||
|
||||
import static org.springframework.cloud.gateway.handler.predicate.PathRequestPredicateFactory.PATTERN_KEY;
|
||||
import static org.springframework.cloud.gateway.handler.predicate.RequestPredicateFactory.PATTERN_KEY;
|
||||
import static org.springframework.tuple.TupleBuilder.tuple;
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,9 @@ public class GatewayRequestPredicates {
|
||||
|
||||
//TODO: add support for HeaderRequestPredicateFactory
|
||||
|
||||
//TODO: add support for HostRequestPredicateFactory
|
||||
public static RequestPredicate host(String pattern) {
|
||||
return new HostRequestPredicateFactory().apply(tuple().of(PATTERN_KEY, pattern));
|
||||
}
|
||||
|
||||
//TODO: add support for MethodRequestPredicateFactory
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.web.reactive.function.server.RequestPredicates;
|
||||
*/
|
||||
public class HostRequestPredicateFactory implements RequestPredicateFactory {
|
||||
|
||||
public static final String PATTERN_KEY = "pattern";
|
||||
private PathMatcher pathMatcher = new AntPathMatcher(".");
|
||||
|
||||
public void setPathMatcher(PathMatcher pathMatcher) {
|
||||
|
||||
@@ -30,8 +30,6 @@ import java.util.List;
|
||||
*/
|
||||
public class PathRequestPredicateFactory implements RequestPredicateFactory {
|
||||
|
||||
public static final String PATTERN_KEY = "pattern";
|
||||
|
||||
private PathPatternParser pathPatternParser;
|
||||
|
||||
public void setPathPatternParser(PathPatternParser pathPatternParser) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.web.reactive.function.server.RequestPredicate;
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface RequestPredicateFactory extends ArgumentHints {
|
||||
String PATTERN_KEY = "pattern";
|
||||
|
||||
RequestPredicate apply(Tuple args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user