Fix compatibility issue with spring 5
This commit is contained in:
@@ -24,8 +24,8 @@ import java.util.function.Predicate;
|
||||
|
||||
import org.springframework.tuple.Tuple;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.util.patterns.PathPattern;
|
||||
import org.springframework.web.util.patterns.PathPatternParser;
|
||||
import org.springframework.web.util.pattern.PathPattern;
|
||||
import org.springframework.web.util.pattern.PathPatternParser;
|
||||
|
||||
import static org.springframework.cloud.gateway.handler.support.RoutePredicateFactoryUtils.traceMatch;
|
||||
import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
|
||||
|
||||
@@ -48,9 +48,9 @@ public class RemoteAddrRoutePredicateFactory implements RoutePredicateFactory {
|
||||
}
|
||||
|
||||
return exchange -> {
|
||||
Optional<InetSocketAddress> remoteAddress = exchange.getRequest().getRemoteAddress();
|
||||
if (remoteAddress.isPresent()) {
|
||||
String hostAddress = remoteAddress.get().getAddress().getHostAddress();
|
||||
InetSocketAddress remoteAddress = exchange.getRequest().getRemoteAddress();
|
||||
if (remoteAddress != null) {
|
||||
String hostAddress = remoteAddress.getAddress().getHostAddress();
|
||||
String host = exchange.getRequest().getURI().getHost();
|
||||
|
||||
if (!hostAddress.equals(host)) {
|
||||
|
||||
Reference in New Issue
Block a user