use of org.springframework.web.servlet.handler.SimpleMappingExceptionResolver in project Ganster-CMS by Gangster-trio.
the class ShiroConfig method simpleMappingExceptionResolver.
/**
* 处理异常跳转页面
*/
@Bean
public SimpleMappingExceptionResolver simpleMappingExceptionResolver() {
SimpleMappingExceptionResolver simpleMappingExceptionResolver = new SimpleMappingExceptionResolver();
Properties exceptionMappers = new Properties();
exceptionMappers.setProperty("org.apache.shiro.authz.UnauthorizedException", "403");
exceptionMappers.setProperty("org.apache.shiro.authz.UnauthenticatedException", "403");
simpleMappingExceptionResolver.setExceptionMappings(exceptionMappers);
return simpleMappingExceptionResolver;
}
use of org.springframework.web.servlet.handler.SimpleMappingExceptionResolver in project Ganster-CMS by Gangster-trio.
the class ShiroConfig method simpleMappingExceptionResolver.
/**
* 处理异常跳转页面
*/
@Bean
public SimpleMappingExceptionResolver simpleMappingExceptionResolver() {
SimpleMappingExceptionResolver simpleMappingExceptionResolver = new SimpleMappingExceptionResolver();
Properties exceptionMappers = new Properties();
exceptionMappers.setProperty("org.apache.shiro.authz.UnauthorizedException", "403");
exceptionMappers.setProperty("org.apache.shiro.authz.UnauthenticatedException", "403");
simpleMappingExceptionResolver.setExceptionMappings(exceptionMappers);
return simpleMappingExceptionResolver;
}
use of org.springframework.web.servlet.handler.SimpleMappingExceptionResolver in project spring-boot-examples by ityouknow.
the class ShiroConfig method createSimpleMappingExceptionResolver.
@Bean(name = "simpleMappingExceptionResolver")
public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
SimpleMappingExceptionResolver r = new SimpleMappingExceptionResolver();
Properties mappings = new Properties();
// 数据库异常处理
mappings.setProperty("DatabaseException", "databaseError");
mappings.setProperty("UnauthorizedException", "403");
// None by default
r.setExceptionMappings(mappings);
// No default
r.setDefaultErrorView("error");
// Default is "exception"
r.setExceptionAttribute("ex");
// r.setWarnLogCategory("example.MvcLogger"); // No default
return r;
}
use of org.springframework.web.servlet.handler.SimpleMappingExceptionResolver in project Asqatasun by Asqatasun.
the class ExceptionResolverConfiguration method createSimpleMappingExceptionResolver.
@Bean
public SimpleMappingExceptionResolver createSimpleMappingExceptionResolver() {
SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();
Properties errorMaps = new Properties();
errorMaps.setProperty("org.asqatasun.webapp.exception.ForbiddenUserException", "access-denied");
errorMaps.setProperty("org.asqatasun.webapp.exception.ForbiddenPageException", "access-denied");
errorMaps.setProperty("org.asqatasun.webapp.exception.ForbiddenAuditException", "access-denied");
errorMaps.setProperty("org.asqatasun.webapp.exception.LostInSpaceException", "oups");
errorMaps.setProperty("org.asqatasun.webapp.exception.KrashAuditException", "oups");
errorMaps.setProperty("org.springframework.web.bind.MissingServletRequestParameterException", "access-denied");
errorMaps.setProperty("org.springframework.web.method.annotation.support.MethodArgumentNotValidException", "access-denied");
resolver.setExceptionMappings(errorMaps);
Properties statusCodeMaps = new Properties();
statusCodeMaps.setProperty("access-denied", "403");
statusCodeMaps.setProperty("oups", "200");
resolver.setStatusCodes(statusCodeMaps);
resolver.setDefaultStatusCode(404);
return resolver;
}
Aggregations