lotus

贵有恒何必三更眠五更起 最无益只怕一日曝十日寒

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

 

最近在学习filter,看完理论知识之后,就特地在实际工作中的系统中去验证。

SSP系统实例如下:

1.在web.xml中寻找 filter的配置信息

  如下:

 <filter>
  <filter-name>passoFilter</filter-name>
  <filter-class>com.pingan.passo.wls.client.filter.SSOClientFilter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>passoFilter</filter-name>
  <url-pattern>/login</url-pattern>
 </filter-mapping>
 <filter>
  <filter-name>CookieFilter</filter-name>
  <filter-class>com.paic.phssp.common.filter.CookieFilter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>CookieFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 <filter> 
     <filter-name>SecurityAclFilter</filter-name> 
     <filter-class>com.paic.phssp.common.filter.SecurityAclFilter</filter-class> 
 </filter>
 <filter-mapping>
  <filter-name>SecurityAclFilter</filter-name>
  <url-pattern>*.do</url-pattern>
 </filter-mapping>
 <filter-mapping>
  <filter-name>SecurityAclFilter</filter-name>
  <url-pattern>*.screen</url-pattern>
 </filter-mapping>
 <filter> 
     <filter-name>AppScanFilter</filter-name> 
     <filter-class>com.paic.phssp.common.filter.AppScanFilter</filter-class>
     <init-param>
            <param-name>excludedPages</param-name>
            <param-value>/phssp/document.create.check.prop.do,/phssp/document.create.content.do,/phssp/document.create.new.do,/phssp/document.create.update.do,/phssp/document.editPreView.do,/phssp/newDocument.detialPreView.do,/phssp/document.detialPreView.do,/phssp/document.downLoadPdf.do,/phssp/document.detialPreWordView.do,/appsvr/phssp/redis/test</param-value><!-- 匹配不做拦截的请求声明-->
        </init-param>
 </filter>
 <filter-mapping>
  <filter-name>AppScanFilter</filter-name>
  <url-pattern>*.do</url-pattern>
 </filter-mapping>
 <filter-mapping>
  <filter-name>AppScanFilter</filter-name>
  <url-pattern>*.screen</url-pattern>
 </filter-mapping>
 <filter>
     <filter-name>UMSecurityFilter</filter-name>
     <filter-class>
         com.pingan.security.client.filter.UMSecurityFilter
     </filter-class>
     <init-param>
         <param-name>SecurityPropertiesName</param-name>
         <param-value>um-security.properties</param-value>
     </init-param>
     <init-param>
         <description>不希望被拦截的页面, 默认不拦截js css 图片</description>
         <param-name>publicPages</param-name>
         <param-value>/login;/login.jsp;/ssologin.jsp;/logout.jsp;/ssp/privilege/ISendUserPrivilege.do;/appsvr/phssp/doc/generate.do;/appsvr/phssp/redis/test;/phssp/newDocument.detialPreView.do;/phssp/pdfsign.manage.getBasemessage.do;/phssp/pdfsign.manage.getBasemessage.do</param-value>
     </init-param>
     <init-param>
         <param-name>UserRoleService</param-name>
         <param-value>
             com.pingan.security.client.policy.acl.service.UM2UserRoleService
         </param-value>
     </init-param>
 </filter>
 <filter-mapping>
     <filter-name>UMSecurityFilter</filter-name>
     <url-pattern>*</url-pattern>
     <dispatcher>REQUEST</dispatcher>
     <dispatcher>FORWARD</dispatcher>
 </filter-mapping> 
 
 <filter>
  <filter-name>Set Character Encoding</filter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  <init-param>
   <param-name>encoding</param-name>
   <param-value>UTF-8</param-value>
  </init-param>
 </filter>
 <filter-mapping>
  <filter-name>Set Character Encoding</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 
     <filter>
  <filter-name>RefererFilter</filter-name>
  <filter-class>com.paic.phssp.common.filter.RefererFilter</filter-class>
 </filter>
 <filter-mapping>
  <filter-name>RefererFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

其中有四个是在代码中有实现的,其他 都是引用第三方jar包的。

 

 

下面我们就来看看这四个实现的filter

 

AppScanFilter.java

 

posted on 2018-04-30 17:20  白露~  阅读(203)  评论(0编辑  收藏  举报