分享一个朋友的人工智能教程。零基础!通俗易懂!风趣幽默!大家可以看看是否对自己有帮助,点击查看教程。

1.https://blog.csdn.net/xtiawxf/article/details/52571949

https://blog.csdn.net/hxm_code/article/details/50136173

https://blog.csdn.net/melodykke/article/details/81362447

https://www.cnblogs.com/foxting/p/6790331.html?utm_source=itdadao&utm_medium=referral 登录次数

springboot2+shiro 无权限、异常、异步返回

http://www.bubuko.com/infodetail-1629577.html

/**
* 对controller异常进行全局处理
* 区分了对普通请求和ajax请求的异常处理,普通请求返回到配置的errorCode页面,或者返回到指定的页面
* @author
*
*/
public class CustomException extends SimpleMappingExceptionResolver {
private final transient Logger logger = LoggerFactory.getLogger(getClass()); @Override
protected ModelAndView doResolveException(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) {
String viewName = determineViewName(ex, request);
if (viewName != null) {// JSP格式返回
//增加普通提交返回到自己页面errorPage
String errorPage = String.valueOf(request.getAttribute("errorPage"));
//回到自己的页面
if(StringUtils.isNotBlank(errorPage)){
viewName = errorPage;
}
if (!(request.getHeader("accept").indexOf("application/json") > -1 || (request
.getHeader("X-Requested-With") != null && request
.getHeader("X-Requested-With").indexOf("XMLHttpRequest") > -1))) {
// 如果不是异步请求
// Apply HTTP status code for error views, if specified.
// Only apply it if we‘re processing a top-level request.
Integer statusCode = determineStatusCode(request, viewName);
if (statusCode != null) {
applyStatusCodeIfPossible(request, response, statusCode);
}
return getModelAndView(viewName, ex, request);
} else {// JSON格式返回
try {
Map<String, Object> jsonMap = new HashMap<String, Object>();
// 返回是错误
jsonMap.put(BaseController.AJAX_RESULT, false);
jsonMap.put(BaseController.RESULT_MESSAGE, ex.getMessage());
response.setContentType("text/html;charset=UTF-8");
PrintWriter writer = response.getWriter();
writer.write(JSON.toJSONString(jsonMap));
writer.close();
} catch (Exception e) {
logger.error("doResolveException", "系统异常!", e);
}
return null; }
} else {
return null;
}
}
}
<bean class="cn.tomcat.quickstart.exception.CustomException">
<!-- 定义默认的异常处理页面,当该异常类型的注册时使用 -->
<property name="defaultErrorView" value="error"></property>
<!-- 定义异常处理页面用来获取异常信息的变量名,默认名为exception -->
<property name="exceptionAttribute" value="ex"></property>
<!-- 定义需要特殊处理的异常,用类名或完全路径名作为key,异常也页名作为值 -->
<property name="exceptionMappings">
<props>
<prop key="IOException">error/ioexp</prop>
<prop key="java.sql.SQLException">error/sqlexp</prop>
</props>
</property>
</bean>

最新文章

  1. IOS的七种手势
  2. 完全卸载mysql步骤
  3. 长年承接AR图像识别项目,关于高速UnityARCam多图问题技术整理
  4. ArrayList集合&amp;特殊集合
  5. MVC5 + EF6 入门完整教程二
  6. jQurey 获取当前时间
  7. 【服务器环境搭建-Centos】tmpfs,【转载】
  8. Jquery select 选中项中自定义的值
  9. 一个高在线(可以超过1024)多线程的socket echo server(pthreads 和 libevent扩展)
  10. [前端引用] 利用ajax实现类似php include require 等命令的功能
  11. linux提权总结(外文)
  12. 总结iframe高度自适应,自适应子页面高度
  13. angular2在模板中使用属性引发Cannot read property &#39;xxx&#39; of undefined
  14. 使用concurrent.futures模块中的线程池与进程池
  15. bash test命令探秘
  16. 【API】网络编程模型、多线程
  17. 【Unity Shader】(九) ------ 高级纹理之渲染纹理及镜子与玻璃效果的实现
  18. swoole1.8.0+版本异步redis安装(本实例为swoole1.8.10版本)详解
  19. 文献综述二:UML技术在行业资源平台系统建模中的应用
  20. 使用jconsole监控tomcat(推荐配置)

热门文章

  1. C语言数组成绩排序
  2. JSTL1.0和JSTL1.1的区别
  3. liunx命令用到的
  4. Ternsorflow 学习:005-MNIST入门 实现模型
  5. 第三单元总结:JML规格定义下的程序设计、验证与测试
  6. 通过 Service 访问 Pod【转】
  7. 解决fedora28桌面图标问题
  8. Redis混合存储-冷热数据识别与交换
  9. 09 MySQL字符集
  10. 怎么更改Rstudio中的默认目录