+package de.juplo.integrationtest;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.reactive.function.client.WebClient;
+
+
+/**
+ * Fetches data from remote-webserver and renders them as HTML.
+ * @author Kai Moritz
+ */
+@Controller
+public class RemoteContentController
+{
+ WebClient webClient;
+
+
+ public RemoteContentController(@Value("${remote.host}")String remoteHost)
+ {
+ webClient = WebClient.create(remoteHost);
+ }
+
+
+ @GetMapping("/")
+ public String renderRemoteText(Model model, @RequestParam String path)
+ {
+ model.addAttribute(
+ "text",
+ webClient
+ .get()
+ .uri(path)
+ .retrieve()
+ .bodyToMono(String.class).block());
+
+ return "layout";
+ }
+}