WIP
[demos/httpresources] / src / main / java / de / juplo / demo / httpresources / DefaceController.java
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 (file)
index 0000000..5c30031
--- /dev/null
@@ -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;
+  }
+}