@ -59,7 +60,7 @@ public class DiscoveryClientRouteLocator implements RouteLocator {
@@ -59,7 +60,7 @@ public class DiscoveryClientRouteLocator implements RouteLocator {
// add a predicate that matches the url at /serviceId/**
@ -69,7 +70,8 @@ public class DiscoveryClientRouteLocator implements RouteLocator {
@@ -69,7 +70,8 @@ public class DiscoveryClientRouteLocator implements RouteLocator {
@ -61,7 +62,7 @@ public class RemoveNonProxyHeadersWebFilterFactory implements WebFilterFactory {
@@ -61,7 +62,7 @@ public class RemoveNonProxyHeadersWebFilterFactory implements WebFilterFactory {
@ -28,9 +32,13 @@ public class RemoveRequestHeaderWebFilterFactory implements WebFilterFactory {
@@ -28,9 +32,13 @@ public class RemoveRequestHeaderWebFilterFactory implements WebFilterFactory {
@ -42,7 +43,7 @@ public class SecureHeadersWebFilterFactory implements WebFilterFactory {
@@ -42,7 +43,7 @@ public class SecureHeadersWebFilterFactory implements WebFilterFactory {
@ -153,16 +155,49 @@ public class FilteringWebHandler extends WebHandlerDecorator {
@@ -153,16 +155,49 @@ public class FilteringWebHandler extends WebHandlerDecorator {
if(filter==null){
thrownewIllegalArgumentException("Unable to find WebFilterFactory with name "+definition.getName());
}
Map<String,String>args=definition.getArgs();
if(logger.isDebugEnabled()){
List<String>args;
if(definition.getArgs()!=null){
args=Arrays.asList(definition.getArgs());
}else{
args=Collections.emptyList();
}
logger.debug("Route "+id+" applying filter "+args+" to "+definition.getName());
}
returnfilter.apply(definition.getArgs());
//TODO: move Tuple building to common class, see RequestPredicateFactory.lookup
TupleBuilderbuilder=TupleBuilder.tuple();
List<String>argNames=filter.argNames();
if(!argNames.isEmpty()){
// ensure size is the same for key replacement later
@ -170,10 +170,12 @@ public class RequestPredicateHandlerMapping extends AbstractHandlerMapping {
@@ -170,10 +170,12 @@ public class RequestPredicateHandlerMapping extends AbstractHandlerMapping {
List<String>argNames=found.argNames();
if(!argNames.isEmpty()){
// ensure size is the same for key replacement later
thrownewIllegalArgumentException("Wrong number of arguments. Expected "+argNames
+" "+argNames+". Found "+args.size()+" "+args+"'");
}
}
}
@ -193,6 +195,15 @@ public class RequestPredicateHandlerMapping extends AbstractHandlerMapping {
@@ -193,6 +195,15 @@ public class RequestPredicateHandlerMapping extends AbstractHandlerMapping {
}
Tupletuple=builder.build();
if(found.validateArgs()){
for(Stringname:argNames){
if(!tuple.hasFieldName(name)){
thrownewIllegalArgumentException("Missing argument '"+name+"'. Given "+tuple);
@ -39,7 +39,7 @@ public class QueryRequestPredicateFactory implements RequestPredicateFactory {
@@ -39,7 +39,7 @@ public class QueryRequestPredicateFactory implements RequestPredicateFactory {