Class SplibExceptionHandler

java.lang.Object
jp.ecuacion.splib.web.exceptionhandler.SplibExceptionHandler

public abstract class SplibExceptionHandler extends Object
Provides an exception handler.
  • Constructor Details

    • SplibExceptionHandler

      public SplibExceptionHandler()
  • Method Details

    • getController

      @Nonnull protected SplibGeneralController<?> 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
      Catches AppWarningException.
      Parameters:
      exception - AppWarningException
      loginUser - UserDetails, may be null when 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
      Catches AppException.
      Parameters:
      exception - AppException
      loginUser - 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
      Catches OverlappingFileLockException.
      Parameters:
      exception - AppException
      loginUser - 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)
      Catches HttpRequestMethodNotSupportedException, 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
      Catches NoResourceFoundException, 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)
      Catches HtmlFileNotFoundException, which means ShowPageController cannot 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)
      Catches HtmlFileNotAllowedToOpenException, which means ShowPageController notices 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)
      Catches Throwable.
      Parameters:
      exception - Throwable
      model - model
      Returns:
      ModelAndView