1700484610
rd.forward(req,res);
1700484611
1700484612
}
1700484613
1700484614
public void init(FilterConfig arg0)throws ServletException{
1700484615
1700484616
/*
1700484617
1700484618
*1、检查XML配置文件是否正确
1700484619
1700484620
*2、启动监控程序,观察配置文件是否正确
1700484621
1700484622
*/
1700484623
1700484624
}
1700484625
1700484626
//通过url获得actionName
1700484627
1700484628
private String getActionNameFromURI(HttpServletRequest req){
1700484629
1700484630
String path=(String)req.getRequestURI();
1700484631
1700484632
String actionName=path.substring(path.lastIndexOf(”/”)+1,
1700484633
1700484634
path.lastIndexOf(”.”));
1700484635
1700484636
return actionName;
1700484637
1700484638
}
1700484639
1700484640
}
1700484641
1700484642
我们按照系统的执行顺序来讲解,首先在容器的配置文件中需要配置该过滤器,以tomcat为例,配置如代码清单38-2所示。
1700484643
1700484644
代码清单38-2 核心控制器的配置
1700484645
1700484646
<?xml version=“1.0”encoding=“UTF-8”?>
1700484647
1700484648
<web-app>
1700484649
1700484650
<filter>
1700484651
1700484652
<display-name>FilterDispatcher</display-name>
1700484653
1700484654
<filter-name>FilterDispatcher</filter-name>
1700484655
1700484656
<filter-class>{包名}.FilterDispatcher</filter-class>
1700484657
1700484658
</filter>
1700484659
[
上一页 ]
[ :1.70048461e+09 ]
[
下一页 ]