WIP: welcom + error - 404 anstatt 500
authorKai Moritz <kai@juplo.de>
Sat, 18 Jun 2016 21:43:10 +0000 (23:43 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 18 Jun 2016 21:43:10 +0000 (23:43 +0200)
src/main/java/de/juplo/thymeproxy/Application.java
src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java [new file with mode: 0644]
src/main/java/de/juplo/thymeproxy/ExceptionMappings.java [deleted file]

index 7eb7333..48bea7d 100644 (file)
@@ -118,9 +118,9 @@ public class Application extends WebMvcConfigurerAdapter
   }
 
   @Bean
-  public ExceptionMappings exceptionMappings()
+  public DefaultExceptionHandler defaultExceptionHandler()
   {
-    return new ExceptionMappings();
+    return new DefaultExceptionHandler();
   }
 
 
diff --git a/src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java b/src/main/java/de/juplo/thymeproxy/DefaultExceptionHandler.java
new file mode 100644 (file)
index 0000000..6fb89b5
--- /dev/null
@@ -0,0 +1,33 @@
+package de.juplo.thymeproxy;
+
+
+import javax.servlet.http.HttpServletRequest;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.servlet.ModelAndView;
+import org.thymeleaf.exceptions.TemplateInputException;
+
+
+
+/**
+ *
+ * @author Kai Moritz
+ */
+@ControllerAdvice
+public class DefaultExceptionHandler
+{
+  @ResponseStatus(HttpStatus.NOT_FOUND)
+  @ExceptionHandler(value = TemplateInputException.class)
+  public ModelAndView templateInputExceptionHandler(
+      HttpServletRequest request,
+      TemplateInputException e
+      )
+  {
+    ModelAndView mav = new ModelAndView("templates/404");
+    mav.addObject("template", e.getTemplateName());
+    mav.addObject("uri", request.getRequestURI());
+    return mav;
+  }
+}
diff --git a/src/main/java/de/juplo/thymeproxy/ExceptionMappings.java b/src/main/java/de/juplo/thymeproxy/ExceptionMappings.java
deleted file mode 100644 (file)
index a265e3f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-package de.juplo.thymeproxy;
-
-
-import javax.servlet.http.HttpServletRequest;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.servlet.ModelAndView;
-import org.thymeleaf.exceptions.TemplateInputException;
-
-
-
-/**
- *
- * @author Kai Moritz
- */
-@ControllerAdvice
-public class ExceptionMappings
-{
-  @ResponseStatus(HttpStatus.NOT_FOUND) 
-  @ExceptionHandler(value = TemplateInputException.class)
-  public ModelAndView templateInputExceptionHandler(
-      HttpServletRequest request,
-      TemplateInputException e
-      )
-  {
-    ModelAndView mav = new ModelAndView("templates/404");
-    mav.addObject("template", e.getTemplateName());
-    mav.addObject("uri", request.getRequestURI());
-    return mav;
-  }
-}