adds host() moves PATTERN_KEY up

This commit is contained in:
Spencer Gibb
2017-03-18 00:09:44 -06:00
parent 3aff230f6a
commit 9f6d983856
4 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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);