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

项目:uckefu    文件: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) ;
    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?referer="+java.net.URLEncoder.encode(request.getRequestURL().toString() , "UTF-8"));
    }
    return filter ; 
}
项目:crnk-framework    文件:CrnkErrorControllerAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(value = ErrorController.class, search = SearchStrategy.CURRENT)
public BasicErrorController jsonapiErrorController(ErrorAttributes errorAttributes) {
    return new CrnkErrorController(errorAttributes, this.serverProperties.getError(), this.errorViewResolvers);
}