Class CustomErrorController

java.lang.Object
org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController
org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController
edu.ucsb.cs156.frontiers.controllers.CustomErrorController
All Implemented Interfaces:
org.springframework.boot.web.servlet.error.ErrorController

@Controller public class CustomErrorController extends org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController
Custom error controller that replaces the default white label error page with a more user-friendly error page.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomErrorController(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes, org.springframework.boot.autoconfigure.web.ServerProperties properties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.web.servlet.ModelAndView
    errorHtml(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Handles error requests and returns a custom error page.

    Methods inherited from class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController

    error, getErrorAttributeOptions, getErrorProperties, isIncludeBindingErrors, isIncludeMessage, isIncludePath, isIncludeStackTrace, mediaTypeNotAcceptable

    Methods inherited from class org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController

    getBooleanParameter, getErrorAttributes, getErrorsParameter, getMessageParameter, getPathParameter, getStatus, getTraceParameter, resolveErrorView

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CustomErrorController

      public CustomErrorController(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes, org.springframework.boot.autoconfigure.web.ServerProperties properties)
  • Method Details

    • errorHtml

      @RequestMapping(produces="text/html") public org.springframework.web.servlet.ModelAndView errorHtml(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Handles error requests and returns a custom error page.
      Overrides:
      errorHtml in class org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController
      Parameters:
      request - the HTTP request
      response - the HTTP response
      Returns:
      the name of the error view template