



下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、精品文檔/* (#)AuthorityInterceptor.java*創(chuàng)建日期:2011-04-19* Copyright(c)20102011 hitsoftware co.,Ltd*/package erceptor;import java.io.IOException;import org.springframework.web.servlet.HandlerInterceptor;import org.springframework.web.servlet.ModelAndView;import javax.servlet.http.*;
2、import java.util.*;import com.hsoft.framework.bean.UserSession;/*權限攔截,用于在用戶登錄與操作過程中的身份權限的驗證* see UserSession* see HandlerInterceptor* see ModelAndView*更新日志: 修改人 版本號 時間 修改內容 蘆寧1.0.0 2011-04-19添加注釋* author蘆寧* version 1.0.0 2011-04-19*/public class AuthorityInterceptor implements HandlerInterceptor *處理
3、之前,對用戶身份進行驗證* param request HttpServletRequest對象* param response HttpServletResponse對象* param handler Object對象* return返回一個布爾型數(shù)值*/SuppressWarnings(unchecked)public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Objecthandler) throws Exception try if (handler.getClass().ge
4、tName().indexOf(LoginCtrl) = 0) return true;UserSession userSession = (UserSession) request.getSession() .getAttribute(userSession);1歡迎下載精品文檔if (userSession = null) sendRedirect(request, response); return false;Map map = request.getParameterMap();for (Iterator iter = map.entrySet().iterator(); iter.
5、hasNext();) Map.Entry element =(Map.Entry) iter.next(); String s = (String) element.getValue();if (s = null | s.length 1) sendError(request, response); return false; else if (s0.indexOf() != -1) sendError(request, response); return false; List list = (List) request.getSession().getAttribute(visit);/
6、System.out.println(url-);/for (Iterator it = list.iterator(); it.hasNext();) /System.out.println(url+(String)it.next();/if (list = null | list.size() 0) url += method= +request.getParameter(method); else url += request.getQueryString();String tempurl = ;for (Iterator it = list.iterator(); it.hasNext
7、();) tempurl = / + (String) it.next(); if(url.indexOf(tempurl) != -1) /System.out.println(url:+url);/System.out.println(url:+temp); /System.out.println(url:+url.indexOf(temp);2歡迎下載/時請刪除此行。精品文檔b = true;break;if (!b) / System.out.println(jcbk the request of + url interrupted);sendError(request, respon
8、se);return false;return true; catch (Exception e) sendRedirect(request, response); return false;*處理之后,對用戶身份進行驗證,暫無實現(xiàn)內容* param request HttpServletRequest對象* param response HttpServletResponse對象* param handler Object對象* param modelAndView ModelAndView對象*/public void postHandle(HttpServletRequest reque
9、st, HttpServletResponse response,Object handler, ModelAndView modelAndView) throws Exception *完成操作之后,對用戶身份進行驗證,暫無實現(xiàn)內容* param request HttpServletRequest對象* param response HttpServletResponse對象* param handler Object對象* param ex Exception對象*/public void afterCompletion(HttpServletRequest request, HttpS
10、ervletResponseresponse, Object handler, Exception ex) throws Exception *用戶ID在Session中失效時或用戶操作出現(xiàn)異常時,導向登出頁面* param request傳遞的HttpServletRequest對象3歡迎下載精品文檔+ is* param response傳遞的HttpServletResponse對象*/private void sendRedirect(HttpServletRequest request, HttpServletResponse response) try response.sendRedirect(./logout.jsp); catch (IOException e) e.printStackTrace();/*出錯時,導向錯誤頁面* param request傳遞的HttpServletRequest對象* param response傳遞的HttpServletResponse對象*/private void sendError(HttpServletRequest request, HttpServ
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 專題22 能源與可持續(xù)發(fā)展-2025年中考《物理》一輪復習知識清單與解題方法
- 二零二五年度藥品研發(fā)成果許可與銷售分成合同范本
- 2025年度勞動合同法企業(yè)勞動爭議調解中心設立合同
- 河道整治砂石運輸合同模板
- 2025年度生物科技行業(yè)勞動合同解除協(xié)議范本
- 2025年度供應鏈金融應收賬款回款合作協(xié)議
- 家具銷售居間合同文件資料
- 2025年度品牌連鎖店鋪授權經(jīng)營合同
- 2025年度山林資源承包與生態(tài)補償金支付合同書
- 二零二五年度企業(yè)員工績效對賭合作框架協(xié)議
- 護苗行動安全教育課件
- 生物-山東省濰坊市、臨沂市2024-2025學年度2025屆高三上學期期末質量檢測試題和答案
- 2025年小學督導工作計劃
- 2024-2025學年部編版歷史九年級上冊期末復習練習題(含答案)
- 礦山工程安全培訓課件
- 基于ChatGPT的ESG評級體系實現(xiàn)機制研究
- 2024年精對苯二甲酸市場分析報告
- 成人手術后疼痛評估與護理團體標準
- 2025年中考數(shù)學二輪專題復習 題型四-二次函數(shù)圖象與性質綜合題
- 春節(jié)申遺成功的意義
- 上海市黃浦區(qū)2022-2023學年九年級上學期期末化學試卷(一模)
評論
0/150
提交評論