“玩转”Java系列—Struts2 运行流程分析
2014-03-17 13:53
411 查看
1.Struts2 运行流程如下:
1). 请求发送给 StrutsPrepareAndExecuteFilter
2). StrutsPrepareAndExecuteFilter 询问 ActionMapper: 该请求是否是一个 Struts2 请求(即是否返回一个非空的 ActionMapping 对象)
3). 若 ActionMapper 认为该请求是一个 Struts2 请求,则 StrutsPrepareAndExecuteFilter把请求的处理交给 ActionProxy
4). ActionProxy 通过ConfigurationManager询问框架的配置文件,确定需要调用的 Action 类及 Action 方法
5). ActionProxy 创建一个 ActionInvocation的实例,并进行初始化
6). ActionInvocation 实例在调用Action的过程前后,涉及到相关拦截器(Intercepter)的调用。
7). Action 执行完毕,ActionInvocation 负责根据 struts.xml 中的配置找到对应的返回结果。调用结果的 execute 方法,渲染结果。在渲染的过程中可以使用Struts2 框架中的标签。
8). 执行各个拦截器 invocation.invoke() 之后的代码
9). 把结果发送到客户端
[b]更多Java培训学习资料,请登录尚硅谷网站下载:www.atguigu.com[/b]
2.相关 API:
1). ActionMapping:Simple class that holds the action mapping information used to invoke a Struts action. The name and namespace are required
2). ActionMapper: When given an HttpServletRequest, the ActionMapper may return null if no action invocation request matches, or it may return an ActionMapping that describes an action invocation for the framework to try
3). ActionProxy:ActionProxy is an extra layer between XWork and the action so that different proxies are possible.
4). 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 the ActionProxy, then by the Interceptors, the Interceptors
are all executed, and then the Action and the Result.
1). 请求发送给 StrutsPrepareAndExecuteFilter
2). StrutsPrepareAndExecuteFilter 询问 ActionMapper: 该请求是否是一个 Struts2 请求(即是否返回一个非空的 ActionMapping 对象)
3). 若 ActionMapper 认为该请求是一个 Struts2 请求,则 StrutsPrepareAndExecuteFilter把请求的处理交给 ActionProxy
4). ActionProxy 通过ConfigurationManager询问框架的配置文件,确定需要调用的 Action 类及 Action 方法
5). ActionProxy 创建一个 ActionInvocation的实例,并进行初始化
6). ActionInvocation 实例在调用Action的过程前后,涉及到相关拦截器(Intercepter)的调用。
7). Action 执行完毕,ActionInvocation 负责根据 struts.xml 中的配置找到对应的返回结果。调用结果的 execute 方法,渲染结果。在渲染的过程中可以使用Struts2 框架中的标签。
8). 执行各个拦截器 invocation.invoke() 之后的代码
9). 把结果发送到客户端
[b]更多Java培训学习资料,请登录尚硅谷网站下载:www.atguigu.com[/b]
2.相关 API:
1). ActionMapping:Simple class that holds the action mapping information used to invoke a Struts action. The name and namespace are required
2). ActionMapper: When given an HttpServletRequest, the ActionMapper may return null if no action invocation request matches, or it may return an ActionMapping that describes an action invocation for the framework to try
3). ActionProxy:ActionProxy is an extra layer between XWork and the action so that different proxies are possible.
4). 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 the ActionProxy, then by the Interceptors, the Interceptors
are all executed, and then the Action and the Result.
相关文章推荐
- “玩转”Java系列—Struts2 面试题分析
- 8、Struts2 运行流程分析
- Struts2运行流程分析
- struts2运行流程分析
- Struts2 运行流程分析
- Struts2运行流程分析
- [原创]java WEB学习笔记70:Struts2 学习之路-- struts2拦截器源码分析,运行流程
- 分析基于Jsp+Servlet+JavaBean的个人信息管理系统的运行流程
- 玩转Windows服务系列——服务运行、停止流程浅析
- Struts2-12 Struts2运行流程分析
- 27. Struts2运行流程分析
- Struts2-运行流程分析
- Java程序员从笨鸟到菜鸟之(四十)细谈struts2(四)struts2中action执行流程和源码分析
- [笔记]架构探险-从零开始写JavaWeb框架-2.1. 之使框架具有aop特性-aop框架加载与切面运行流程分析
- Java程序员从笨鸟到菜鸟之(四十)细谈struts2(四)struts2中action执行流程和源码分析
- Java程序员从笨鸟到菜鸟之(四十)细谈struts2(四)struts2中action执行流程和源码分析
- JAVAWEB开发之Struts2详解(一)——Struts2框架介绍与快速入门、流程分析与工具配置以及Struts2的配置以及Action和Result的详细使用
- Java学习系列(三)Java运算符、控制语句、数组及其在内存中的运行分析
- Struts2源码分析(二)Struts2运行流程分析
- Java学习系列(三)Java运算符、控制语句、数组及其在内存中的运行分析