|
@@ -103,7 +103,7 @@ public class GatewayParamParser<T> { |
|
|
private String parseClientIp(/*@Valid*/ GatewayParamFlowItem item, T request) { |
|
|
private String parseClientIp(/*@Valid*/ GatewayParamFlowItem item, T request) { |
|
|
String clientIp = requestItemParser.getRemoteAddress(request); |
|
|
String clientIp = requestItemParser.getRemoteAddress(request); |
|
|
String pattern = item.getPattern(); |
|
|
String pattern = item.getPattern(); |
|
|
if (pattern == null) { |
|
|
|
|
|
|
|
|
if (StringUtil.isEmpty(pattern)) { |
|
|
return clientIp; |
|
|
return clientIp; |
|
|
} |
|
|
} |
|
|
return parseWithMatchStrategyInternal(item.getMatchStrategy(), clientIp, pattern); |
|
|
return parseWithMatchStrategyInternal(item.getMatchStrategy(), clientIp, pattern); |
|
@@ -114,7 +114,7 @@ public class GatewayParamParser<T> { |
|
|
String pattern = item.getPattern(); |
|
|
String pattern = item.getPattern(); |
|
|
// TODO: what if the header has multiple values? |
|
|
// TODO: what if the header has multiple values? |
|
|
String headerValue = requestItemParser.getHeader(request, headerKey); |
|
|
String headerValue = requestItemParser.getHeader(request, headerKey); |
|
|
if (pattern == null) { |
|
|
|
|
|
|
|
|
if (StringUtil.isEmpty(pattern)) { |
|
|
return headerValue; |
|
|
return headerValue; |
|
|
} |
|
|
} |
|
|
// Match value according to regex pattern or exact mode. |
|
|
// Match value according to regex pattern or exact mode. |
|
@@ -124,7 +124,7 @@ public class GatewayParamParser<T> { |
|
|
private String parseHost(/*@Valid*/ GatewayParamFlowItem item, T request) { |
|
|
private String parseHost(/*@Valid*/ GatewayParamFlowItem item, T request) { |
|
|
String pattern = item.getPattern(); |
|
|
String pattern = item.getPattern(); |
|
|
String host = requestItemParser.getHeader(request, "Host"); |
|
|
String host = requestItemParser.getHeader(request, "Host"); |
|
|
if (pattern == null) { |
|
|
|
|
|
|
|
|
if (StringUtil.isEmpty(pattern)) { |
|
|
return host; |
|
|
return host; |
|
|
} |
|
|
} |
|
|
// Match value according to regex pattern or exact mode. |
|
|
// Match value according to regex pattern or exact mode. |
|
@@ -135,7 +135,7 @@ public class GatewayParamParser<T> { |
|
|
String paramName = item.getFieldName(); |
|
|
String paramName = item.getFieldName(); |
|
|
String pattern = item.getPattern(); |
|
|
String pattern = item.getPattern(); |
|
|
String param = requestItemParser.getUrlParam(request, paramName); |
|
|
String param = requestItemParser.getUrlParam(request, paramName); |
|
|
if (pattern == null) { |
|
|
|
|
|
|
|
|
if (StringUtil.isEmpty(pattern)) { |
|
|
return param; |
|
|
return param; |
|
|
} |
|
|
} |
|
|
// Match value according to regex pattern or exact mode. |
|
|
// Match value according to regex pattern or exact mode. |
|
@@ -146,7 +146,7 @@ public class GatewayParamParser<T> { |
|
|
String cookieName = item.getFieldName(); |
|
|
String cookieName = item.getFieldName(); |
|
|
String pattern = item.getPattern(); |
|
|
String pattern = item.getPattern(); |
|
|
String param = requestItemParser.getCookieValue(request, cookieName); |
|
|
String param = requestItemParser.getCookieValue(request, cookieName); |
|
|
if (pattern == null) { |
|
|
|
|
|
|
|
|
if (StringUtil.isEmpty(pattern)) { |
|
|
return param; |
|
|
return param; |
|
|
} |
|
|
} |
|
|
// Match value according to regex pattern or exact mode. |
|
|
// Match value according to regex pattern or exact mode. |
|
|