Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/4601#discussion_r139633588
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/DispatcherRestEndpoint.java
---
@@ -77,8 +74,11 @@ protected void setupChannelHandlers(Router router,
CompletableFuture<String> res
optWebContent = Optional.empty();
}
- optWebContent.ifPresent(
- webContentHandler -> router.GET("/:*",
webContentHandler));
+ return optWebContent
+ .map(webContent ->
+ Collections.singleton(
+ Tuple2.<RestHandlerSpecification,
ChannelInboundHandler>of(WebContentHandlerSpecification.getInstance(),
webContent)))
+ .orElseGet(() -> Collections.emptySet());
--- End diff --
Given that we're adding new handlers soon we may want to write things so
that we can more easily extend the collection it without rewriting most of this
block.
```
Collection<Tuple2<RestHandlerSpecification, ChannelInboundHandler>> result
= new ArrayList<>();
optWebContent
.map(webContent -> result.add(webContent));
return result;
```
---