一.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. PHP输出缓冲控制- Output Control 函数应用详解

    说到输出缓冲,首先要说的是一个叫做缓冲器(buffer)的东西.举个简单的例子说明他的作用:我们在编辑一篇文档时,在我们没有保存之前,系统是不会向磁盘写入的,而是写到buffer中,当buffer写满 ...

  2. Windows 7下配置JDK环境变量和Java环境变量配置

    下面来介绍一下Java环境变量配置,是在Windows 7下配置JDK环境变量. 方法/步骤  1 安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为:C:\Program Fil ...

  3. 运行Android应用时提示ADB是否存在于指定路径问题

    打开eclipse,选择指定的Android应用工程并Run,提示: [2014-06-28 11:32:26 - LinearLayout] The connectionto adb is down ...

  4. ASP.NET Web API上实现 Web Socket

    1. 什么是Web Socket Web Socket是Html5中引入的通信机制,它为浏览器与后台服务器之间提供了基于TCP的全双工的通信通道.用以替代以往的LongPooling等comet st ...

  5. 【转载】Java中如何写一段内存泄露的程序 & ThreadLocal 介绍和使用

    可以参考这段文章: link A1:通过以下步骤可以很容易产生内存泄露(程序代码不能访问到某些对象,但是它们仍然保存在内存中): 上文中提到了使用ThreadLocal造成了内存泄露,但是写的不清不楚 ...

  6. bundle update: env: ruby_executable_hooks: No such file or directory

    please open a bug here: https://github.com/mpapis/executable-hooks/issues as a temporary fix try: rv ...

  7. Android之界面刷新(invalidate和postInvalidate使用)

    Android中实现view的更新有两组方法,一组是invalidate,另一组是postInvalidate,其中前者是在UI线程自身中使用,而后者在非UI线程中使用. Android提供了Inva ...

  8. ACM - ICPC World Finals 2013 D Factors

    原题下载:http://icpc.baylor.edu/download/worldfinals/problems/icpc2013.pdf 题目翻译: 问题描述 一个最基本的算数法则就是大于1的整数 ...

  9. Json转译

    public string ListToJson<T>(IList<T> list, string jsonName) { StringBuilder Json = new S ...

  10. 【js】js方法中直接跳转到servlet

    function firm_back_state(id,name){ if(confirm("确认返单?")){ location.href="Edit_OrderSer ...