exception error
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Error!</h1>
|
||||
<h1>BAD_REQUEST!</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Error!</h1>
|
||||
<h1>REQUEST NOT_FOUND !</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1> INTERNAL_SERVER_ERROR!</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Error!</h1>
|
||||
<h1>Not Implemented !</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Service Unavailable !</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Error!</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user