从web.xml部署文件的配置可以看出StrutsPrepareAndExecuteFilter时一切action请求的必经之类。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
此系列文章通过struts2的源码,学习struts2的运行过程与原理。一切根源从核心过滤器StrutsPrepareAndExecuteFilter开始。
(当每次启动服务器的时候第一次请求都会调用该类的init方法,随后的请求会调用doFilter。)
此系列文章将按照 init()->doFilter()->destroy() 的顺序进行学习。
目录
未完,待更新。