diff options
author | Vitaly Takmazov | 2017-04-07 10:29:52 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-04-07 10:29:52 +0300 |
commit | 9820abe11c0c037f50bb2f7ddbb0bd19646264dc (patch) | |
tree | 5a33901fc294546c40b0cdbc65640b041e4c694e /juick-spring-www/src/main/java/com/juick/www/controllers/ErrorController.java | |
parent | 6951e2ad47ed4db3dc7d0b08aeadeb09bc3b994d (diff) |
juick-www: merge juick-spring-www i18n, drop thymeleaf
Diffstat (limited to 'juick-spring-www/src/main/java/com/juick/www/controllers/ErrorController.java')
-rw-r--r-- | juick-spring-www/src/main/java/com/juick/www/controllers/ErrorController.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/juick-spring-www/src/main/java/com/juick/www/controllers/ErrorController.java b/juick-spring-www/src/main/java/com/juick/www/controllers/ErrorController.java deleted file mode 100644 index 57a34076..00000000 --- a/juick-spring-www/src/main/java/com/juick/www/controllers/ErrorController.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.juick.www.controllers; - -import com.juick.server.util.HttpBadRequestException; -import com.juick.server.util.HttpForbiddenException; -import com.juick.server.util.HttpNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; - -/** - * Created by aalexeev on 12/12/16. - */ -@ControllerAdvice -public class ErrorController { - private static Logger logger = LoggerFactory.getLogger(ErrorController.class); - - @ExceptionHandler(HttpBadRequestException.class) - @ResponseStatus(value = HttpStatus.BAD_REQUEST) - public String badRequest() { - return "views/error"; - } - - @ExceptionHandler(HttpForbiddenException.class) - @ResponseStatus(value = HttpStatus.FORBIDDEN) - public String forbidden() { - return "views/error"; - } - - @ExceptionHandler(HttpNotFoundException.class) - @ResponseStatus(value = HttpStatus.NOT_FOUND) - public String notFound() { - return "views/error"; - } - - @ExceptionHandler(Throwable.class) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public String exception(final Throwable throwable, final Model model) { - logger.error("Exception during execution of SpringSecurity application", throwable); - - String errorMessage = (throwable != null ? throwable.getMessage() : "Unknown error"); - model.addAttribute("errorMessage", errorMessage); - - return "views/error"; - } -} |