n the diagram, an initial request goes to the Servlet container (such as Jetty or Resin) which is passed through a standard filter chain. The chain includes the (optional) ActionContextCleanUp filter, which is useful when integrating technologies such as SiteMesh Plugin. Next, the required FilterDispatcher is called, which in turn consults the ActionMapper to determine if the request should invoke an action.

If the ActionMapper determines that an Action should be invoked, the FilterDispatcher delegates control to the ActionProxy. The ActionProxy consults the framework Configuration Files manager (initialized from the struts.xml file). Next, the ActionProxy creates an ActionInvocation, which is responsible for the command pattern implementation. This includes invoking any Interceptors (the before clause) in advance of invoking the Action itself.

Once the Action returns, the ActionInvocation is responsible for looking up the proper result associated with the Action result code mapped in struts.xml. The result is then executed, which often (but not always, as is the case for Action Chaining) involves a template written in JSP or FreeMarker to be rendered. While rendering, the templates can use the Struts Tags provided by the framework. Some of those components will work with the ActionMapper to render proper URLs for additional requests.

All objects in this architecture (Actions, ResultsInterceptors, and so forth) are created by an ObjectFactory. This ObjectFactory is pluggable. We can provide our own ObjectFactory for any reason that requires knowing when objects in the framework are created. A popular ObjectFactory implementation uses Spring as provided by the Spring Plugin.

Interceptors are executed again (in reverse order, calling the after clause). Finally, the response returns through the filters configured in the web.xml. If the ActionContextCleanUp filter is present, the FilterDispatcher will not clean up the ThreadLocal ActionContext. If the ActionContextCleanUp filter is not present, the FilterDispatcher will cleanup all ThreadLocals.

 https://cwiki.apache.org/confluence/display/WW/The+Struts+2+Request+Flow

struts原理图的更多相关文章

  1. 4.Struts2转向类型详解

    struts2中提供了多种视图转向类型,类型由type属性指定,如: dispatcher:请求转发(默认值) redirect:重定向到页面 redirectAction:重定向到Action pl ...

  2. 最佳新秀SSH十六Struts2它是如何工作的内部

    前面说完了Spring.Hibernate,非常自然今天轮到struts了.struts的核心原理就是通过拦截器来处理client的请求,经过拦截器一系列的处理后,再交给Action.以下先看看str ...

  3. 菜鸟学SSH(十六)——Struts2内部是如何工作的

    前面说完了Spring.Hibernate,很自然今天轮到struts了.struts的核心原理就是通过拦截器来处理客户端的请求,经过拦截器一系列的处理后,再交给Action.下面先看看struts官 ...

  4. 轻量级Java EE开发框架设计系统应用架构

    首先来说一下Java EE 概述 其中常说的三大框架即是:ssh Spring:功能强大的组件粘合济,能够将你的所有的java功能模块用配置文件的方式组合起来(还让你感觉不到spring的存在)成为一 ...

  5. Struts 2.3.24源码解析+Struts2拦截参数,处理请求,返回到前台过程详析

    Struts2官网:http://struts.apache.org/ 目前最新版本:Struts 2.3.24 Struts1已经完全被淘汰了,而Struts2是借鉴了webwork的设计理念而设计 ...

  6. Struts 2知识回顾----拦截器(Intercept)总结

    什么是Struts 2拦截器? 从软件构架上来说,拦截器是实现了面向方面编程的组件.它将影响了多个业务对象的公共行为封装到一个个可重用的模块,减少了系统的重复代码,实现功能的高度内聚,确保了业务对象的 ...

  7. Java Web编程的主要组件技术——Struts入门

    参考书籍:<J2EE开源编程精要15讲> Struts是一个开源的Java Web框架,很好地实现了MVC设计模式.通过一个配置文件,把各个层面的应用组件联系起来,使组件在程序层面联系较少 ...

  8. Struts面试笔记

    Struts2面试题1.struts2工作流程Struts 2框架本身大致可以分为3个部分:核心控制器FilterDispatcher.业务控制器Action和用户实现的企业业务逻辑组件. 核心控制器 ...

  9. struts详细解释拦截器

    1.拦截器:Struts2拦截器将一个Action要么Action的方法.之前或截取后场,和Struts2拦截器是可插拔,拦截器AOP一种实现. WebWork:拦截器是动态拦截Action调用的对象 ...

随机推荐

  1. django模型之meta使用

    模型元数据Meta是“任何不是字段的数据”,比如排序选项(ordering),数据库表名(db_table)或者人类可读的单复数名称(verbose_name 和verbose_name_plural ...

  2. postgresql copy的使用方式

    方法一: 将数据库表复制到磁盘文件: copy "Test" to 'G:/Test.csv' delimiter ',' csv header encoding 'GBK'; 从 ...

  3. 【Jmeter自学】JMeter的安装(一)

    ==================================================================================================== ...

  4. python学习笔记_week11

    一.RabbitMQ python的queue(生产者消费者模型)分为线程queue(不能跨进程)和进程queue(父进程与子进程进行交互或者同属于同一父进程下多个子进程进行交互),那两个独立的进程间 ...

  5. 17. 判断是否IE浏览器

    var isNotIE = !window.VBArray;    //判断是否IE浏览器    if(isNotIE) {        //如果不是IE浏览器        $("#da ...

  6. Appium——主从控制执行

    1.客户端(Eclipse)机器A, 服务端(appium.Genymotion)机器B 2.设置Appium,Server Address为192.168.17.123,重新启动Appium 3.在 ...

  7. shell中的逻辑判断while

    w|head -1|awk -F'load average: ' '{print $2}'|cut -d. -f1 #!/bin/bash while true do load=`w|head -1| ...

  8. Ubuntu12.04 内核树建立

    先查看自己使用的内核版本 lin@lin-virtual-machine:~$ uname -r --generic 如果安装系统时,自动安装了源码.在 /usr/src 目录下有对应的使用的版本目录 ...

  9. usb之python(pyusb)

    电脑系统为WIN7 64位 python:为python3.6 32位 需要插件PyUSB-1.0.0.tar,pywinusb-0.4.2. 按照的步骤我偷懒了,自己百度一下. 我们先看设备管理的 ...

  10. dev16 cxgrid 在DLL里报0地址错

    dev16 cxgrid 在DLL里Form里使用,报0地址错,在EXE里正常.c++builder 的DLL报错,delphi也报错. First chance exception at $09CE ...