Class BasicErrorController

  • All Implemented Interfaces:
    org.springframework.boot.web.servlet.error.ErrorController

    @Controller
    @RequestMapping("${server.error.path:${error.path:/error}}")
    public class BasicErrorController
    extends AbstractErrorController
    Basic global error Controller, rendering ErrorAttributes. More specific errors can be handled either using Spring MVC abstractions (e.g. @ExceptionHandler) or by adding servlet server error pages.
    See Also:
    ErrorAttributes, ErrorProperties
    • Constructor Detail

      • BasicErrorController

        public BasicErrorController​(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes,
                                    ErrorProperties errorProperties)
        Create a new BasicErrorController instance.
        Parameters:
        errorAttributes - the error attributes
        errorProperties - configuration properties
      • BasicErrorController

        public BasicErrorController​(org.springframework.boot.web.servlet.error.ErrorAttributes errorAttributes,
                                    ErrorProperties errorProperties,
                                    List<ErrorViewResolver> errorViewResolvers)
        Create a new BasicErrorController instance.
        Parameters:
        errorAttributes - the error attributes
        errorProperties - configuration properties
        errorViewResolvers - error view resolvers
    • Method Detail

      • errorHtml

        @RequestMapping(produces="text/html")
        public org.springframework.web.servlet.ModelAndView errorHtml​(javax.servlet.http.HttpServletRequest request,
                                                                      javax.servlet.http.HttpServletResponse response)
      • error

        @RequestMapping
        public org.springframework.http.ResponseEntity<Map<String,​Object>> error​(javax.servlet.http.HttpServletRequest request)
      • isIncludeStackTrace

        protected boolean isIncludeStackTrace​(javax.servlet.http.HttpServletRequest request,
                                              org.springframework.http.MediaType produces)
        Determine if the stacktrace attribute should be included.
        Parameters:
        request - the source request
        produces - the media type produced (or MediaType.ALL)
        Returns:
        if the stacktrace attribute should be included