org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setDefaultErrorView ( )源码实例Demo

下面列出了org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setDefaultErrorView ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Spring-Boot-Book   文件: ShiroConfig.java
@Bean(name = "simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver
createSimpleMappingExceptionResolver() {
    SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();
    Properties mappings = new Properties();
    mappings.setProperty("DatabaseException", "databaseError");//数据库异常处理
    mappings.setProperty("UnauthorizedException", "403");
    r.setExceptionMappings(mappings);
    r.setDefaultErrorView("error");
    r.setExceptionAttribute("ex");     // 缺省值"exception"
    return r;
}
 
源代码2 项目: spring-boot-demo   文件: ShiroConfig.java
/**
 * 异常处理
 *
 * @return
 */
@Bean(name = "simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
    SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();

    Properties mappings = new Properties();
    mappings.setProperty("DatabaseException", "databaseError");
    mappings.setProperty("UnauthorizedException", "403");
    r.setExceptionMappings(mappings);

    r.setDefaultErrorView("error");
    r.setExceptionAttribute("ex");
    return r;
}
 
源代码3 项目: springBoot-study   文件: ShiroConfig.java
@Bean(name="simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver
createSimpleMappingExceptionResolver() {
	SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();
	Properties mappings = new Properties();
	mappings.setProperty("DatabaseException", "databaseError");//数据库异常处理
	mappings.setProperty("UnauthorizedException","403");
	r.setExceptionMappings(mappings);  // None by default
	r.setDefaultErrorView("error");    // No default
	r.setExceptionAttribute("ex");     // Default is "exception"
	//r.setWarnLogCategory("example.MvcLogger");     // No default
	return r;
}