类org.springframework.boot.autoconfigure.web.BasicErrorController源码实例Demo

下面列出了怎么用org.springframework.boot.autoconfigure.web.BasicErrorController的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: youkefu   文件: UserInterceptorHandler.java
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
	boolean filter = false; 
    User user = (User) request.getSession(true).getAttribute(UKDataContext.USER_SESSION_NAME) ;
    if(handler instanceof HandlerMethod) {
     HandlerMethod  handlerMethod = (HandlerMethod ) handler ;
     Menu menu = handlerMethod.getMethod().getAnnotation(Menu.class) ;
     if(user != null || (menu!=null && menu.access()) || handlerMethod.getBean() instanceof BasicErrorController){
     	filter = true;
     }
     
     if(!filter){
     	response.sendRedirect("/login.html");
     }
    }else {
    	filter =true ;
    }
    return filter ; 
}
 
@Bean
@ConditionalOnMissingBean(value = ErrorController.class, search = SearchStrategy.CURRENT)
public BasicErrorController jsonapiErrorController(ErrorAttributes errorAttributes) {
	return new CrnkErrorController(errorAttributes, this.serverProperties.getError(), this.errorViewResolvers);
}
 
 类方法
 同包方法