package de.juplo.demo;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class DemoApplication {
- public static void main(String[] args) {
+ @Bean
+ public RemoteContentController remoteContentController(
+ @Value("${remote.host}")String remoteHost)
+ {
+ return new RemoteContentController(remoteHost);
+ }
+
+
+ public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
--- /dev/null
+package de.juplo.demo;
+
+
+<<<<<<< HEAD:src/main/java/de/juplo/demo/RemoteContentController.java
+=======
+>>>>>>> f9152f7... WIP: Implemented...:src/main/java/de/juplo/integrationtest/RemoteContentController.java
+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
+ */
+public class RemoteContentController
+{
+ WebClient webClient;
+
+
+ public RemoteContentController(WebClient webClient)
+ {
+ this.webClient = webClient;
+ }
+
+
+ @GetMapping("/")
+ public String renderRemoteText(Model model, @RequestParam String path)
+ {
+ model.addAttribute(
+ "text",
+ webClient
+ .get()
+ .uri(path)
+ .retrieve()
+ .bodyToMono(String.class).block());
+
+ return "layout";
+ }
+}
-
+remote.host=http://localhost/
--- /dev/null
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+ <title>Shows Remote-Content</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+ <h1>Remote-Content:</h1>
+ <p th:text="${text}">TEXT</p>
+</body>
+</html>