Add filters() method to Java DSL.

Deprecates direct filter methods after predicates.

Thanks @joshlong
This commit is contained in:
Spencer Gibb
2018-02-02 16:22:31 -05:00
parent 7f92ea1213
commit da2f28e25b
4 changed files with 231 additions and 14 deletions

View File

@@ -45,19 +45,21 @@ public class GatewaySampleApplication {
//@formatter:off
return builder.routes()
.route(r -> r.host("**.abc.org").and().path("/image/png")
.addResponseHeader("X-TestHeader", "foobar")
.uri("http://httpbin.org:80")
.filters(f ->
f.addResponseHeader("X-TestHeader", "foobar"))
.uri("http://httpbin.org:80")
)
.route(r -> r.path("/image/webp")
.addResponseHeader("X-AnotherHeader", "baz")
.filters(f ->
f.addResponseHeader("X-AnotherHeader", "baz"))
.uri("http://httpbin.org:80")
)
.route(r -> r.order(-1)
.host("**.throttle.org").and().path("/get")
.filter(throttle.apply(1,
.filters(f -> f.filter(throttle.apply(1,
1,
10,
TimeUnit.SECONDS))
TimeUnit.SECONDS)))
.uri("http://httpbin.org:80")
)
.build();