4 import org.springframework.http.MediaType;
5 import org.springframework.stereotype.Controller;
6 import org.springframework.ui.Model;
7 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.RequestParam;
9 import reactor.core.publisher.Mono;
13 * Fetches data from a remote-webserver and renders it as HTML.
17 public class HtmlController
19 RemoteContentService service;
22 public HtmlController(RemoteContentService service)
24 this.service = service;
28 @GetMapping(path = { "", "/" }, produces = MediaType.TEXT_HTML_VALUE)
29 public String fetch(Model model, @RequestParam(required = false) String path)
31 model.addAttribute("path", path);
38 .onErrorResume(t -> Mono.just(t.getMessage())));