Module jp.ecuacion.splib.web
Class SplibExceptionHandler
java.lang.Object
jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler
Provides an exception handler.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SplibGeneralController<?> Returns the controller from which the exception throws.org.springframework.web.servlet.ModelAndViewhandleAppException(jp.ecuacion.lib.core.exception.checked.AppException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesAppException.org.springframework.web.servlet.ModelAndViewhandleAppWarningException(WebAppWarningException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesAppWarningException.org.springframework.web.servlet.ModelAndViewCatchesHtmlFileNotAllowedToOpenException, which meansShowPageControllernotices the html file doesn't have the needed option at the html tag.org.springframework.web.servlet.ModelAndViewCatchesHtmlFileNotFoundException, which meansShowPageControllercannot find the html file specified to the parameter of the url.org.springframework.web.servlet.ModelAndViewhandleHttpRequestMethodNotSupportedException(org.springframework.web.HttpRequestMethodNotSupportedException exception) CatchesHttpRequestMethodNotSupportedException, which means HTTP response 403.voidhandleNoResourceFoundException(org.springframework.web.servlet.resource.NoResourceFoundException exception) CatchesNoResourceFoundException, which means HTTP response 404.org.springframework.web.servlet.ModelAndViewhandleOptimisticLockingFailureException(OverlappingFileLockException exception, org.springframework.security.core.userdetails.UserDetails loginUser) CatchesOverlappingFileLockException.org.springframework.web.servlet.ModelAndViewhandleThrowable(Throwable exception, org.springframework.ui.Model model) CatchesThrowable.
-
Constructor Details
-
SplibExceptionHandler
public SplibExceptionHandler()
-
-
Method Details
-
getController
Returns the controller from which the exception throws.- Returns:
- SplibGeneralController
-
handleAppWarningException
@ExceptionHandler(jp.ecuacion.lib.core.exception.checked.AppWarningException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleAppWarningException(@Nonnull WebAppWarningException exception, @Nullable @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesAppWarningException.- Parameters:
exception- AppWarningExceptionloginUser- UserDetails, may benullwhen the user is not logged in- Returns:
- ModelAndView
- Throws:
Exception- Exception
-
handleAppException
@ExceptionHandler(jp.ecuacion.lib.core.exception.checked.AppException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleAppException(@Nonnull jp.ecuacion.lib.core.exception.checked.AppException exception, @Nullable @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesAppException.- Parameters:
exception- AppExceptionloginUser- UserDetails- Returns:
- ModelAndView
- Throws:
Exception- Exception
-
handleOptimisticLockingFailureException
@ExceptionHandler(java.nio.channels.OverlappingFileLockException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleOptimisticLockingFailureException(@Nonnull OverlappingFileLockException exception, @Nullable @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails loginUser) throws Exception CatchesOverlappingFileLockException.- Parameters:
exception- AppExceptionloginUser- UserDetails- Returns:
- ModelAndView
- Throws:
Exception- Exception
-
handleHttpRequestMethodNotSupportedException
@ExceptionHandler(org.springframework.web.HttpRequestMethodNotSupportedException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleHttpRequestMethodNotSupportedException(@Nonnull org.springframework.web.HttpRequestMethodNotSupportedException exception) CatchesHttpRequestMethodNotSupportedException, which means HTTP response 403.- Parameters:
exception- HttpRequestMethodNotSupportedException- Returns:
- redirect URL
-
handleNoResourceFoundException
@ExceptionHandler(org.springframework.web.servlet.resource.NoResourceFoundException.class) public void handleNoResourceFoundException(@Nonnull org.springframework.web.servlet.resource.NoResourceFoundException exception) throws org.springframework.web.servlet.resource.NoResourceFoundException CatchesNoResourceFoundException, which means HTTP response 404.This throws NoResourceFoundException again, that means this method do nothing. It's used just to debug 404 occurrence procedure.
- Parameters:
exception- NoResourceFoundException- Throws:
org.springframework.web.servlet.resource.NoResourceFoundException- NoResourceFoundException
-
handleHtmlFileNotFoundException
@ExceptionHandler(HtmlFileNotFoundException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleHtmlFileNotFoundException(@Nonnull HtmlFileNotFoundException exception) CatchesHtmlFileNotFoundException, which meansShowPageControllercannot find the html file specified to the parameter of the url.Since users can set the url parameter, system error is not very preferable.
- Parameters:
exception- HtmlFileNotFoundException- Returns:
- ModelAndView
-
handleHtmlFileNotAllowedToOpenException
@ExceptionHandler(HtmlFileNotAllowedToOpenException.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleHtmlFileNotAllowedToOpenException(@Nonnull HtmlFileNotAllowedToOpenException exception) CatchesHtmlFileNotAllowedToOpenException, which meansShowPageControllernotices the html file doesn't have the needed option at the html tag.- Parameters:
exception- HtmlFileNotAllowedToOpenException- Returns:
- ModelAndView
-
handleThrowable
@ExceptionHandler(java.lang.Throwable.class) @Nonnull public org.springframework.web.servlet.ModelAndView handleThrowable(@Nonnull Throwable exception, @Nonnull org.springframework.ui.Model model) CatchesThrowable.- Parameters:
exception- Throwablemodel- model- Returns:
- ModelAndView
-