[BAEL-3311] Code formatting
This commit is contained in:
parent
3d6d0765a3
commit
68dee74200
|
@ -8,8 +8,8 @@ public class CustomRoutersGatewayApplication {
|
|||
|
||||
public static void main(String[] args) {
|
||||
new SpringApplicationBuilder(CustomRoutersGatewayApplication.class)
|
||||
.profiles("customroutes")
|
||||
.run(args);
|
||||
.profiles("customroutes")
|
||||
.run(args);
|
||||
}
|
||||
|
||||
}
|
|
@ -24,15 +24,15 @@ public class CustomPredicatesConfig {
|
|||
public RouteLocator routes(RouteLocatorBuilder builder, GoldenCustomerRoutePredicateFactory gf ) {
|
||||
|
||||
return builder.routes()
|
||||
.route("dsl_golden_route", r -> r.path("/dsl_api/**")
|
||||
.filters(f -> f.stripPrefix(1))
|
||||
.uri("https://httpbin.org")
|
||||
.predicate(gf.apply(new Config(true, "customerId"))))
|
||||
.route("dsl_common_route", r -> r.path("/dsl_api/**")
|
||||
.filters(f -> f.stripPrefix(1))
|
||||
.uri("https://httpbin.org")
|
||||
.predicate(gf.apply(new Config(false, "customerId"))))
|
||||
.build();
|
||||
.route("dsl_golden_route", r -> r.path("/dsl_api/**")
|
||||
.filters(f -> f.stripPrefix(1))
|
||||
.uri("https://httpbin.org")
|
||||
.predicate(gf.apply(new Config(true, "customerId"))))
|
||||
.route("dsl_common_route", r -> r.path("/dsl_api/**")
|
||||
.filters(f -> f.stripPrefix(1))
|
||||
.uri("https://httpbin.org")
|
||||
.predicate(gf.apply(new Config(false, "customerId"))))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,27 +41,25 @@ public class GoldenCustomerRoutePredicateFactory extends AbstractRoutePredicateF
|
|||
|
||||
return (ServerWebExchange t) -> {
|
||||
List<HttpCookie> cookies = t.getRequest()
|
||||
.getCookies()
|
||||
.get(config.getCustomerIdCookie());
|
||||
.getCookies()
|
||||
.get(config.getCustomerIdCookie());
|
||||
|
||||
boolean isGolden;
|
||||
if ( cookies == null || cookies.isEmpty()) {
|
||||
isGolden = false;
|
||||
}
|
||||
else {
|
||||
String customerId = cookies.get(0).getValue();
|
||||
isGolden = goldenCustomerService.isGoldenCustomer(customerId);
|
||||
}
|
||||
boolean isGolden;
|
||||
if ( cookies == null || cookies.isEmpty()) {
|
||||
isGolden = false;
|
||||
}
|
||||
else {
|
||||
String customerId = cookies.get(0).getValue();
|
||||
isGolden = goldenCustomerService.isGoldenCustomer(customerId);
|
||||
}
|
||||
|
||||
return config.isGolden()?isGolden:!isGolden;
|
||||
return config.isGolden()?isGolden:!isGolden;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Validated
|
||||
public static class Config {
|
||||
|
||||
boolean isGolden = true;
|
||||
|
||||
@NotEmpty
|
||||
|
|
Loading…
Reference in New Issue