1.1     ActionProxy接口以及实现

ActionProxy在struts框架中发挥着很关键的数据。

通过webwork和xwork交互关系图能够看出。它是action和xwork中间的一层。 正由于ActionProxy的存在导致Action调用更加简洁。

接下来我们一起研究下这个核心类。

1.1.1       ActionProxy接口方法

图 3.3.1 ActionProxy接口主要方法图

ActionConfig getConfig();该方法主要是获得创建ActionProxy类的action配置信息。getExecuteResult()方法就是推断运行后action后是否运行result. getInvocation()获得与ActionProxy相关联的ActionInvocation.

1.1.2       ActionProxy接口实现类

图 3.3.2 ActionProxy接口实现类图

依据命名就知道defaultActionProxy是默认的actionProxy代理。

对于MockActionProxy这个类笔者也不太明确。这个类在struts代码中也没实用。在API中也没有说明,依据字面意思。就是对ActionProxy一个简单实现。

1.1.3       DefaultActionProxy实现类

在dispatcher类中我们能够看到例如以下代码:

proxy.execute();

   

 表示将由ActionProxy代理类来运行action,全部action的主要运行方法就是actionProxy中的execute.

    public String execute() throws Exception {

        ActionContext nestedContext = ActionContext.getContext();

        ActionContext.setContext(invocation.getInvocationContext());

 

        String retCode = null;

 

        String profileKey = "execute: ";

        try {

            UtilTimerStack.push(profileKey);

 

            retCode = invocation.invoke();

        } finally {

            if (cleanupContext) {

                ActionContext.setContext(nestedContext);

            }

            UtilTimerStack.pop(profileKey);

        }

 

        return retCode;

    }

 

图 3.3.3 ActionProxy接口execute方法

首先把InvocationContext设置到ActionContext上下文中。然后调用InvocationContext中的invoke方法运行。

深入struts2.0(六)--ActionProxy类的更多相关文章

  1. 深入struts2.0(五)--Dispatcher类

    1.1.1       serviceAction方法 在上个Filter方法中我们会看到例如以下代码: this.execute.executeAction(request, response, m ...

  2. Struts2.0笔记二

    Mvc与servlet 1.1   Servlet的优点 1.  是mvc的基础,其他的框架比如struts1,struts2,webwork都是从servlet基础上发展过来的.所以掌握servle ...

  3. struts2.0整合json

    框架:struts2.0+hibernate2+spring 今天写代码时,需要用到json,我就直接加了两个jar包:json-lib-2.1-jdk15.jar,struts2-json-plug ...

  4. [转]初探Struts2.0

    本文转自:http://blog.csdn.net/kgd1120/article/details/1667301 Struts作为MVC 2的Web框架,自推出以来不断受到开发者的追捧,得到用广泛的 ...

  5. Struts2实现Preparable接口和【struts2】继承ActionSupport类

    Struts2实现Preparable接口 实现preparable接口,实现public void prepare() throws Exception 方法.当你访问某问action指定方法之前, ...

  6. (转)struts2.0配置文件、常量配置详解

    一.配置: 在struts2中配置常量的方式有三种: 在struts.xml文件中配置 在web.xml文件中配置 在sturts.propreties文件中配置 1.之所以使用struts.prop ...

  7. struts2.0 struts.xml配置文件详解

    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quo ...

  8. Struts2.0+Spring3+Hibernate3(SSH~Demo)

    Struts2.0+Spring3+Hibernate3(SSH~Demo) 前言:整理一些集成框架,发现网上都是一些半成品,都是共享一部分出来(确实让人很纠结),这是整理了一份SSH的测试案例,完全 ...

  9. struts2.0中struts.xml配置文件详解

    先来展示一个配置文件 <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration ...

随机推荐

  1. MySQL 慢查询日志(Slow Query Log)

    同大多数关系型数据库一样.日志文件是MySQL数据库的重要组成部分.MySQL有几种不同的日志文件.通常包含错误日志文件,二进制日志,通用日志.慢查询日志.等等.这些日志能够帮助我们定位mysqld内 ...

  2. atitit.线程死锁 卡住无反应 的原因in cmd调用的解决方案  v3 q39

    atitit.线程死锁 卡住无反应 的原因in cmd调用的解决方案  v3 q39 1. 问题::线程死锁  卡住无反应1 1.1. 分类:: cmd调用,  net io  , file  io  ...

  3. 基于Python3 + OpenCV3.3.1的远程监控程序

    基于Python3 + OpenCV3.3.1的远程监控程序 一.环境配置 OpenCV是一个基于(开源)发行的跨平台计算机视觉库,利用OpenCV能够实现视频图像的捕获. 关于python3中Ope ...

  4. 2. Trailing Zeros【easy】

    2. Trailing Zeros[easy] Write an algorithm which computes the number of trailing zeros in n factoria ...

  5. c++ about SLL(Static-Link Library) and DLL(Dynamic-Link Library)

    First thing first, Wiki: http://en.wikipedia.org/wiki/Dynamic-link_library http://en.wikipedia.org/w ...

  6. Consul实现原理系列文章1: 用Raft来实现分布式一致性

    工作中用到了Consul来做服务发现,之后一段时间里,我会陆续发一些文章来讲述Consul实现原理.在前一篇文章中,我介绍了Raft算法.这篇文章会讲讲Consul是如何使用Raft算法来实现分布式一 ...

  7. genymotion启动报错

    启动genymotion时提示 网络配置有问题,经检查是网卡virtualBox配置的问题,把ip设为自动获取即可 重新启动就可以了

  8. linux oracle配置开机启动

    参考:http://jingyan.baidu.com/article/b2c186c8fe4306c46ef6ff16.html 先以root身份登录到linux系统, 1. 修改vi /etc/o ...

  9. js instanceof (2)

    instanceof运算符可以用来判断某个构造函数的prototype属性是否存在另外一个要检测对象的原型链上.实例一:普遍用法 A instanceof B :检测B.prototype是否存在于参 ...

  10. C# 持续序列化对象追加到文件的方法

    最近有个需求,将内存和帧数数据序列化到二进制文件.为了节省内存,采用了100个对象的数组,每次存满就序列化到文件,然后归零继续存,以追加的性式继续序列化到原有文件. 这样相当于多个数组对象存在了同一个 ...