<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    沉睡森林@漂在北京

    本處文章除注明“轉載”外均為原創,轉載請注明出處。

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      152 隨筆 :: 4 文章 :: 114 評論 :: 0 Trackbacks
    利用攔截器對spring的controller進行了攔截,實現代碼如下:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi
    ="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:aop
    ="http://www.springframework.org/schema/aop" 
        xmlns:p
    ="http://www.springframework.org/schema/p"
        xmlns:context
    ="http://www.springframework.org/schema/context"
        xsi:schemaLocation
    ="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-2.5.xsd"
    >
        
    <context:component-scan base-package="com.example" />
        
    <bean id="handlerMappingTemplate" abstract="true">
            
    <property name="interceptors">
                
    <list>
                    
    <bean class="com.example.aspect.LoginCheckInterceptor" />
                
    </list>
            
    </property>
        
    </bean>
        
    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" parent="handlerMappingTemplate" />
        
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" parent="handlerMappingTemplate" />
        
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
        
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/app/" p:suffix=".jsp" />
    </beans>

    具體的java類代碼也比較簡單
    package com.example.aspect;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;


    public class LoginCheckInterceptor extends HandlerInterceptorAdapter {

        @Override
        
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
            
            System.out.println(
    "\n\n\n\n\n"+request);
            
    throw new Exception("用戶沒有該操作的權限!");
        }
        

    }

    posted on 2009-02-20 15:07 王總兵 閱讀(4444) 評論(0)  編輯  收藏 所屬分類: Spring
    主站蜘蛛池模板: 一级A毛片免费观看久久精品| 四虎成人免费影院网址| 校园亚洲春色另类小说合集| 97亚洲熟妇自偷自拍另类图片| 四虎永久免费影院| 毛片免费观看的视频在线| 久久精品中文字幕免费| 久久毛片免费看一区二区三区| 亚洲AV无码一区二区三区网址| 亚洲一级毛片在线观| 亚洲福利视频导航| 亚洲国产精品VA在线看黑人 | 亚洲国产天堂在线观看| 国产成人亚洲精品91专区手机| 日本人的色道www免费一区| 久久99九九国产免费看小说| 一区二区免费视频| 国产免费AV片在线观看| 久久久WWW成人免费精品| 国产亚洲综合久久| 亚洲AV无码一区二区三区牲色| 国产精品亚洲精品| 亚洲人成影院77777| 亚洲国产精品无码久久久| 黄色a级免费网站| 亚洲国产精品成人午夜在线观看 | 99久久99热精品免费观看国产| 中文字幕免费人成乱码中国| j8又粗又长又硬又爽免费视频| 亚洲视频在线一区| 水蜜桃亚洲一二三四在线| 久久精品视频亚洲| 水蜜桃亚洲一二三四在线| 亚洲一区综合在线播放| 亚洲精品国产情侣av在线| 亚洲精品动漫在线| 国产精品亚洲片在线va| 亚洲欧美日韩一区二区三区 | 黄色永久免费网站| 最新仑乱免费视频| 国产精品免费综合一区视频|