From: Kai Moritz Date: Sat, 9 Jan 2021 08:29:21 +0000 (+0100) Subject: WIP X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=2ef1847c82bb01f9b38ddf53215a841f27e8bca5;p=demos%2Fhttpresources WIP --- 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... + + +