From 2ef1847c82bb01f9b38ddf53215a841f27e8bca5 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 9 Jan 2021 09:29:21 +0100 Subject: [PATCH] WIP --- .../demo/httpresources/DefaceController.java | 25 +++++++++++++++++++ .../demo/httpresources/DemoController.java | 20 --------------- src/main/resources/overwrite/help.html | 14 +++++++++++ 3 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 src/main/java/de/juplo/demo/httpresources/DefaceController.java delete mode 100644 src/main/java/de/juplo/demo/httpresources/DemoController.java create mode 100644 src/main/resources/overwrite/help.html diff --git a/src/main/java/de/juplo/demo/httpresources/DefaceController.java b/src/main/java/de/juplo/demo/httpresources/DefaceController.java new file mode 100644 index 0000000..5c30031 --- /dev/null +++ b/src/main/java/de/juplo/demo/httpresources/DefaceController.java @@ -0,0 +1,25 @@ +package de.juplo.demo.httpresources; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + + +@Controller +public class DefaceController +{ + @RequestMapping("/{path}.html") + public String controller( + @PathVariable String path, + @RequestParam(required = false) String origin, + Model model) + { + if (origin == null) + return "redirect:/help.html"; + + model.addAttribute("template", origin); + return path; + } +} diff --git a/src/main/java/de/juplo/demo/httpresources/DemoController.java b/src/main/java/de/juplo/demo/httpresources/DemoController.java deleted file mode 100644 index 96020ff..0000000 --- a/src/main/java/de/juplo/demo/httpresources/DemoController.java +++ /dev/null @@ -1,20 +0,0 @@ -package de.juplo.demo.httpresources; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; - - -@Controller -public class DemoController -{ - @RequestMapping("/controller.html") - public String controller( - @RequestParam(defaultValue = "index") String template, - Model model) - { - model.addAttribute("template", template); - return template; - } -} diff --git a/src/main/resources/overwrite/help.html b/src/main/resources/overwrite/help.html new file mode 100644 index 0000000..155fe48 --- /dev/null +++ b/src/main/resources/overwrite/help.html @@ -0,0 +1,14 @@ + + + + Help + + +

Help

+ + Start any webserver at http://localhost:8888 or + overwrite origin in the + application.properties... + + + -- 2.20.1