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

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

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

    web.xml中filter的配置

    轉自:http://topic.csdn.net/t/20060322/23/4633313.html

    2.4版本的servlet規范在部屬描述符中新增加了一個<dispatcher>元素,這個元素有四個可能的值:即REQUEST,FORWARD,INCLUDE和ERROR,可以在一個<filter-mapping>元素中加入任意數目的<dispatcher>,使得filter將會作用于直接從客戶端過來的request,通過forward過來的request,通過include過來的request和通過<error-page>過來的request。如果沒有指定任何<   dispatcher   >元素,默認值是REQUEST。可以通過下面幾個例子來輔助理解。  
      例1:  
      <filter-mapping>  
      <filter-name>Logging   Filter</filter-name>  
      <url-pattern>/products/*</url-pattern>  
      </filter-mapping>  
      這種情況下,過濾器將會作用于直接從客戶端發過來的以/products/…開始的請求。因為這里沒有制定任何的<   dispatcher   >元素,默認值是REQUEST。  
       
      例2:  
      <filter-mapping>  
                      <filter-name>Logging   Filter</filter-name>  
                      <servlet-name>ProductServlet</servlet-name>  
                      <dispatcher>INCLUDE</dispatcher>  
      </filter-mapping>  
      這種情況下,如果請求是通過request   dispatcher的include方法傳遞過來的對ProductServlet的請求,則要經過這個過濾器的過濾。其它的諸如從客戶端直接過來的對ProductServlet的請求等都不需要經過這個過濾器。  
      指定filter的匹配方式有兩種方法:直接指定url-pattern和指定servlet,后者相當于把指定的servlet對應的url-pattern作為filter的匹配模式  
      filter的路徑匹配和servlet是一樣的,都遵循servlet規范中《SRV.11.2   Specification   of   Mappings》一節的說明  
       
      例3:  
      <filter-mapping>  
                      <filter-name>Logging   Filter</filter-name>  
                      <url-pattern>/products/*</url-pattern>  
                      <dispatcher>FORWARD</dispatcher>  
                      <dispatcher>REQUEST</dispatcher>  
      </filter-mapping>  
      在這種情況下,如果請求是以/products/…開頭的,并且是通過request   dispatcher的forward方法傳遞過來或者直接從客戶端傳遞過來的,則必須經過這個過濾器。  
      The   dispatcher   has   four   legal   values:   FORWARD,   REQUEST,   INCLUDE,and   ERROR.   A   value   of   FORWARD   means   the   Filter   will   be   appliedunder   RequestDispatcher.forward()   calls.   A   value   of   REQUESTmeans   the   Filter   will   be   applied   under   ordinary   client   calls   to   the   path   or   servlet.   A   value   of   INCLUDE   means   the   Filter   will   be   applied   under   RequestDispatcher.include()   calls.   A   value   of   ERROR   means   the   Filter   will   be   applied   under   the   error   page   mechanism.   The   absence   of   any   dispatcher   elements   in   a   filter-mapping   indicates   a   default   of   applying   filters   only   under   ordinary   client   calls   to   the   path   or   servlet..  

    posted on 2007-08-21 22:28 hijackwust 閱讀(3296) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2007年8月>
    2930311234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

    導航

    統計

    常用鏈接

    留言簿(6)

    隨筆檔案(57)

    友情鏈接

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲精品乱码久久久久66| 国产yw855.c免费视频| 亚洲线精品一区二区三区影音先锋| 亚洲AV无码片一区二区三区 | 亚洲一区二区三区在线观看蜜桃| 久久精品一区二区免费看| 亚洲成a人片77777kkkk| 久久成人无码国产免费播放| 亚洲AV无码第一区二区三区| 污污网站免费观看| 中国人免费观看高清在线观看二区| 免费萌白酱国产一区二区| 狼色精品人妻在线视频免费| 免费不卡中文字幕在线| www免费黄色网| 久久亚洲国产精品五月天| 亚州免费一级毛片| 亚洲欧美不卡高清在线| 亚洲AV无码乱码在线观看性色扶| 羞羞网站免费观看| 亚洲一区二区三区在线播放| 久操免费在线观看| 亚洲成人午夜电影| 国产精品酒店视频免费看| 一级做a毛片免费视频| 亚洲AV无码国产在丝袜线观看| 亚州免费一级毛片| 国产成人久久精品亚洲小说| 亚洲日韩精品射精日| 久久久久久精品成人免费图片| 亚洲精品久久无码av片俺去也| 亚洲成片观看四虎永久| 久久免费观看国产精品| 亚洲av午夜精品无码专区| 国产成人免费A在线视频| a级毛片免费全部播放| 亚洲AV无码一区二区三区人 | 性做久久久久久免费观看| 美国免费高清一级毛片| 亚洲精品无码不卡| 国产性生交xxxxx免费|