生命在于運動

          2007年12月31日 #

          3.2. Filters 過濾器 (to be modified)

            3.2. Filters            
                        過濾器
           

          Acegi Security 使用很多種過濾器,過濾器的內容將會貫穿本參考文檔的剩余部分。你可以選擇怎么樣在你的web應用程序中使用這些過濾器,你可以使用FilterToBeanProxy或者FilterChainProxy。下面我們就會討論這兩個過濾器。

          大多數過濾器都是使用FilterToBeanProxy配置,下面是一個web.xml中配置的例子:

          <filter>

          <filter-name>Acegi HTTP Request Security Filter</filter-name>

          <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>

          <init-param>

          <param-name>targetClass</param-name>

          <param-value>org.acegisecurity.ClassThatImplementsFilter</param-value>

          </init-param>

          </filter>

          請注意,在web.xml中配置的過濾器實際上就是FilterToBeanProxy,而不是真正實現該過濾器邏輯的。FilterToBeanProxy的工作就是將過濾器的方法代理給一個bean,而這個bean能夠從Spring應用的上下文中取到。這個將能夠使bean享受到Spring應用程序上下文的生命周期的支持和配置的靈活性。當然該bean是必須要要實現javax.servlet.Filter的。FilterToBeanProxy僅僅需要一個簡單的初始化參數,targetClass或者targetBeantargetClass是用來定位在應用程序上下文中第一個對象的指定類,而targetBean則是通過bean name來定位對象的。就好像標準的Spring web應用程序FilterToBeanProxy能夠通過WebApplicationContextUtils.getWebApplicationContext(ServletContext)訪問應用程序上下文,所以你該在web.xml中定義一個ContextLoaderListener

          posted @ 2008-01-10 17:35 burrows 閱讀(233) | 評論 (0)編輯 收藏

          Chapter 3. Supporting Infrastructure (todo)

               摘要:   閱讀全文

          posted @ 2008-01-10 17:33 burrows 閱讀(246) | 評論 (0)編輯 收藏

          Spring組件發布包

               摘要:   閱讀全文

          posted @ 2008-01-08 09:33 burrows 閱讀(408) | 評論 (0)編輯 收藏

          2007年最后一天

               摘要:   閱讀全文

          posted @ 2007-12-31 17:45 burrows 閱讀(125) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 水城县| 阿瓦提县| 开远市| 防城港市| 垦利县| 志丹县| 五常市| 罗甸县| 开远市| 蒙自县| 佛山市| 简阳市| 当涂县| 库伦旗| 平泉县| 个旧市| 衡阳市| 博野县| 龙陵县| 含山县| 同德县| 亳州市| 乳源| 新兴县| 综艺| 汝阳县| 榆社县| 蓝山县| 阿克陶县| 潮安县| 大厂| 古交市| 泰宁县| 电白县| 玉树县| 商南县| 榆林市| 于田县| 镇原县| 蒲城县| 小金县|