成人字幕网视频在线观看|久热最新精品品在线|高跟丝袜麻麻求我调教|色先锋av影音先锋在线|调教强迫+粗暴强j+高h文

CRM登錄認證攔截器全局異常(登錄認證攔截器)

1 需求分析

依據用戶信息儲存標準,根據攔截器攔截用戶實際操作要求獲得用戶cookie信息,獲取cookie 中用戶id 用戶紀錄存有性校驗, 校驗不成功,拋出去自定義異常信息,撰寫用戶自定義異常類,捕獲系統異常信息并對自定義異常做相對應網頁頁面回應解決。,servlet-context.xml配備自定 出現異常與登陸攔截器,完成用戶登陸要求攔截校驗作用

2 servlet-context.xml<mvc:interceptors> <mvc:interceptor> <mvc: ** pping path="/**"/> <mvc:exclude- ** pping path="/index"/> <mvc:exclude- ** pping path="/user/userLogin"/> <mvc:exclude- ** pping path="/css/**"/> <mvc:exclude- ** pping path="/jquery-easyui-1.3.3/**"/> <mvc:exclude- ** pping path="/i ** ges/**"/> <mvc:exclude- ** pping path="/js/**"/> <bean class="com.xxx.crm.interceptors.LoginInterceptor"/> </mvc:interceptor> </mvc:interceptors>

3 流程表

4 撰寫LoginInterceptorpublic class LoginInterceptor extends HandlerInterceptorAdapter{ @Resource public UserService userService; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String userId= CookieUtil.getCookieValue(request,"userId"); AssertUtil.isTrue(null==userId,"用戶未登錄"); userId=Base ** Util.decode(userId); User user = userService.queryUserById(userId); AssertUtil.isTrue(null==user,"用戶不會有"); return true;//全局性出現異常 } }喜愛就關心嗨碼歌吧!每日都是新的技術性與你共享哦!

Copyright 2021 快鯨

掃碼免費用

源碼支持二開

申請免費使用

在線咨詢