Could someone please provide an example and an explanation of how this method is used? I am new to project Reactor and I have difficulty getting my head around the way to use it, plus there dont seem to be enough tutorials out there. What I want is to call a service that will return a hostname in String format which I then want to user as uri
This is the method's package and the method:
org.springframework.cloud.gateway.route.builder
/**
* A filter which change the URI the request will be routed to by the Gateway.
* @param determineRequestUri a {@link Function} which takes a
* {@link ServerWebExchange} and returns a URI to route the request to
* @return a {@link GatewayFilterSpec} that can be used to apply additional filters
*/
public GatewayFilterSpec changeRequestUri(Function<ServerWebExchange, Optional<URI>> determineRequestUri) {
return filter(new AbstractChangeRequestUriGatewayFilterFactory<Object>(Object.class) {
@Override
protected Optional<URI> determineRequestUri(ServerWebExchange exchange, Object config) {
return determineRequestUri.apply(exchange);
}
}.apply(c -> {
}));
}