一.Struts2运行流程图:

二.运行流程分析:

1. 请求发送给StrutsPrepareAndExecuteFilter
2.StrutsPrepareAndExecuteFilter询问ActionMapper:该请求是否是一个Struts2请求(即是否返回一个非空的ActionMapping对象)
3. 若ActionMapper认为该请求是一个Struts2请求,则StrutsPrepareAndExecuteFilter把请求的处理交给ActionProxy
. ActionProxy通过ConfigurationManager  读取框架的配置文件,确定需要调用的Action类及Action方法
. ActionProxy创建一个ActionInvocation的实例,并进行初始化
6. ActionInvocation实例在调用Action的过程前后,涉及到相关拦截器(Intercepter)的调用。
7.Action执行完毕,ActionInvocation负责根据struts.xml中的配置找到对应的返回结果。调用Result的execute方法,渲染结果。在渲染的过程中可以使用Struts2框架中的标签。
8. 执行各个拦截器invocation.invoke()之后的代码
9. 把结果发送到客户端

三、相关API

•ActionMapping:Simpleclass that holds the action mapping information used to invoke a Struts action.The name and namespace arerequired
•ActionMapper:Whengiven anHttpServletRequest, theActionMapper
mayreturn null if no action invocation request matches, or it may return anActionMapping thatdescribes an action invocation for the framework totry
•ActionProxy:ActionProxy isan extra layer betweenXWork andthe
action so that different proxies are possible.
•ActionInvocation:AnActionInvocation represents the execution state of an Action. It holds the
Interceptors and the Action instance. By repeated re-entrant execution of the invoke() method,initially by theActionProxy,then by the Interceptors, the Interceptors are all executed, and then
the Action and the Result.

Struts2运行流程分析的更多相关文章

  1. 8、Struts2 运行流程分析

    1.流程分析: 请求发送给 StrutsPrepareAndExecuteFilter StrutsPrepareAndExecuteFilter 询问 ActionMapper: 该请求是否是一个 ...

  2. Struts2 - 运行流程分析

    1. 请求发送给 StrutsPrepareAndExecuteFilter 2. StrutsPrepareAndExecuteFilter 询问 ActionMapper: 该请求是否是一个 St ...

  3. Struts2 运行流程

    Struts2运行流程 1.在web.xml中使用Struts的核心过滤器拦截所有请求. <filter> <filter-name>struts2</filter-na ...

  4. 011-Spring Boot 运行流程分析SpringApplication.run

    一.程序入口 1.1.静态方法 //直接调用run方法 ConfigurableApplicationContext context = SpringApplication.run(App.class ...

  5. 【逆向&编程实战】Metasploit安卓载荷运行流程分析_复现meterpreter模块接管shell

    /QQ:3496925334 作者:MG193.7 CNBLOG博客号:ALDYS4 未经许可,禁止转载/ 关于metasploit的安卓模块,前几次的博客我已经写了相应的分析和工具 [Android ...

  6. thttpd和cgilua安装与运行流程分析

    安装 参考如下博文安装thttpd软件 http://blog.csdn.net/21aspnet/article/details/7045845 http://blog.csdn.net/drago ...

  7. hadoop运行流程分析源代码级

    前言: 最近一直在分析hadoop的运行流程,我们查阅了大量的资料,虽然从感性上对这个流程有了一个认识但是我总是感觉对mapreduce的运行还是没有一个全面的认识,所以决定从源代码级别对mapred ...

  8. springmvc的运行流程分析

    前几篇文章对springmvc讲解的很清楚,大家看下,有问题,我们再一起讨论. 其实springmvc最为重要是它的运行流程,接着,我们来分析一下,其运行过程,废话不多说,看图说话: 分析如下: 1, ...

  9. MapReduce运行流程分析

    研究MapReduce已经有一段时间了.起初是从分析WordCount程序开始,后来开始阅读Hadoop源码,自认为已经看清MapReduce的运行流程.现在把自己的理解贴出来,与大家分享,欢迎纠错. ...

随机推荐

  1. 10个实用的PHP正则表达式

    正则表达式是程序开发中一个重要的元素,它提供用来描述或匹配文本的字符串,如特定的字符.词或算式等.但在某些情况下,用正则表达式去验证一个字符串比较复杂和费时.本文为你介绍10种常见的实用PHP正则表达 ...

  2. C库函数手册(ctype.h)

    ctype.h函数说明:int isalpha(int ch)  若ch是字母('A'-'Z','a'-'z')返回非0值,否则返回0 int isdigit(int ch)  若ch是数字('0'- ...

  3. git push 提示

    我运行git push -u origin master  时提示如下: To git@github.com:userName/project.git ! [rejected] master -> ...

  4. JAVA操作Excel 可配置,动态 生成复杂表头 复杂的中国式报表表头

    转载:开源社区http://www.oschina.net/code/snippet_1424099_49530?p=2代码] [Java]代码 该代码实现了Excel复杂表头的生成 基于sql se ...

  5. Jeally Bean中MonekyRunner 帮助文件

    基于4.2的SDK导出来的MonkeyRunner的最新帮助,这个版本对MonkeyView和MonkeyRect有了很大的加强,在MonkeyRunner的易用性上有了很大的提高. 对于导出Monk ...

  6. setBackgroundDrawable和setBackgroundColor的用法

        1.设置背景图片,图片来源于drawable: flightInfoPanel.setBackgroundDrawable(getResources().getDrawable(R.drawa ...

  7. 解决魅族USB调试无法被电脑识别的问题(含Mac OS X、Win7)

      每次打开豌豆荚或者360手机助手之类手机助手后Eclipse才会检测到mx4(实际上是豌豆荚关闭eclipse的adb使用自己的驱动连接的).解决方法就是在"adb_usb.ini&qu ...

  8. POJ 1486 Sorting Slides (二分图关键匹配边)

    题意 给你n个幻灯片,每个幻灯片有个数字编号1~n,现在给每个幻灯片用A~Z进行编号,在该幻灯片范围内的数字都可能是该幻灯片的数字编号.问有多少个幻灯片的数字和字母确定的. 思路 确定幻灯片的数字就是 ...

  9. JS调用客户端EXE

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  10. 浏览器HTML5支持程度测试

    /********************************************************************* * 浏览器HTML5支持程度测试 * 说明: * 想知道对 ...