exception error

This commit is contained in:
shimingxy
2020-01-06 22:06:05 +08:00
parent 8110d99451
commit b7a0ecddc0
25 changed files with 117 additions and 101 deletions

View File

@@ -37,20 +37,20 @@ public class MaxKeyConfig {
return registration;
}
/**
* 配置默认错误页面仅用于内嵌tomcat启动时
* 使用这种方式在打包为war后不起作用
*
* @return
*/
/**
* 配置默认错误页面仅用于内嵌tomcat启动时
* 使用这种方式在打包为war后不起作用
*
* @return
*/
@Bean
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
return new WebServerFactoryCustomizer<ConfigurableWebServerFactory>() {
@Override
public void customize(ConfigurableWebServerFactory factory) {
ErrorPage errorPage400 = new ErrorPage(HttpStatus.BAD_REQUEST,"/error-400");
ErrorPage errorPage404 = new ErrorPage(HttpStatus.NOT_FOUND,"/error-404");
ErrorPage errorPage500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error-500");
ErrorPage errorPage400 = new ErrorPage(HttpStatus.BAD_REQUEST,"/exception/error/400");
ErrorPage errorPage404 = new ErrorPage(HttpStatus.NOT_FOUND,"/exception/error/404");
ErrorPage errorPage500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/exception/error/500");
factory.addErrorPages(errorPage400, errorPage404,errorPage500);
}

View File

@@ -75,10 +75,4 @@ public class IndexEndpoint {
return new ModelAndView("index");
}
@RequestMapping(value={"/accessdeny"})
public ModelAndView accessdeny() {
_logger.debug("exception/accessdeny.");
return new ModelAndView("exception/accessdeny");
}
}

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h1>Error!</h1>
<h1>BAD_REQUEST!</h1>
</body>
</html>

View File

@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h1>Error!</h1>
<h1>REQUEST NOT_FOUND !</h1>
</body>
</html>

View File

@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h1> INTERNAL_SERVER_ERROR!</h1>
</body>
</html>

View File

@@ -1,5 +1,5 @@
<html>
<body>
<h1>Error!</h1>
<h1>Not Implemented !</h1>
</body>
</html>

View File

@@ -0,0 +1,5 @@
<html>
<body>
<h1>Service Unavailable !</h1>
</body>
</html>

View File

@@ -1,5 +0,0 @@
<html>
<body>
<h1>Error!</h1>
</body>
</html>