b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

filterconfig struts2执行流程(11)

电脑杂谈  发布时间:2018-02-15 05:13:20  来源:网络整理

这一步主要做了三件事:创建Action的代理,封装结果集Result,设置值栈。

实际上是通过调用DefaultActionProxyFactory的createActionProxy方法来创建的Action的代理

public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) {
    // 创建ActionInvocation负责迭代和执行Action
    ActionInvocation inv = new DefaultActionInvocation(extraContext, true);
    // 放入容器中
    container.inject(inv);
    // 调用这个重载的createActionProxy方法
    return createActionProxy(inv, namespace, actionName, methodName, executeResult, cleanupContext);
}

在方法返回的时候调用重载的createActionProxy方法,进入源码看一下:

public ActionProxy createActionProxy(ActionInvocation inv, String namespace, String actionName, String methodName, boolean executeResult, boolean cleanupContext) {

    DefaultActionProxy proxy = new DefaultActionProxy(inv, namespace, actionName, methodName, executeResult, cleanupContext);
    container.inject(proxy);
    // 这里,proxy开始准备
    proxy.prepare();
    return proxy;
}

看这里:proxy.prepare();,proxy开始准备,继续跟源码:

protected void prepare() {
    String profileKey = "create DefaultActionProxy: ";
    try {
        UtilTimerStack.push(profileKey);
        config = configuration.getRuntimeConfiguration().getActionConfig(namespace, actionName);

        if (config == null && unknownHandlerManager.hasUnknownHandlers()) {
            config = unknownHandlerManager.handleUnknownAction(namespace, actionName);
        }
        if (config == null) {
            throw new ConfigurationException(getErrorMessage());
        }

        resolveMethod();

        if (!config.isAllowedMethod(method)) {
            throw new ConfigurationException("Invalid method: " + method + " for action " + actionName);
        }
        // 关键:开始初始化invocation
        invocation.init(this);

    } finally {
        UtilTimerStack.pop(profileKey);
    }
}


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-78438-11.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...