手写请求会通过strutsPrepareAndExcuteFliter的doFilter()方法
然后会调用StrutsActionProxy类的excute()方法,生成一个代理类(ActionProxy)
ActionProxy 是 Action 的一个代理类,也就是说Action的调用是通过 ActionProxy 实现的,
而该方法又调用了ActionInvocation.invoke()方法
然后调用DefaultActionInvocation的invoke()//通过不断的回调这个方法,调用了所有拦截器
ActionInvocation就是Action的调用者。
ActionInvocation在Action的执行过程中,负责Interceptor、Action和Result等一系列元素的调度。
*/
public String invoke() throws Exception {
String profileKey = "invoke: ";
try {
UtilTimerStack.push(profileKey);

if (executed) {
throw new IllegalStateException("Action has already executed");
}

if (interceptors.hasNext()) {//拦截器集合,不断的回调,
final InterceptorMapping interceptor = interceptors.next();
String interceptorMsg = "interceptor: " + interceptor.getName();
UtilTimerStack.push(interceptorMsg);
try {
resultCode = interceptor.getInterceptor().intercept(DefaultActionInvocation.this);
}
finally {
UtilTimerStack.pop(interceptorMsg);//拦截器回调完后,最终通过这个方法来调用Action类方法
}
} else {
resultCode = invokeActionOnly();
}

Strut2流程分析-----从请求到Action方法()的更多相关文章

  1. Struts2基础-4-2 -struts拦截器实现权限控制案例+ 模型驱动处理请求参数 + Action方法动态调用

    1.新建项目,添加jar包到WEB-INF目录下的lib文件夹,并添加到builde path里面 整体目录结构如下 2.新建web.xml,添加struts2核心过滤器,和默认首页 <?xml ...

  2. Action请求流程分析

    Strut2流程分析-----从请求到Action方法() 首先请求会调用strutsPrepareAndExcuteFliter----(这个就是我们在web.xml文件中所配置的那个拦截器吧,所有 ...

  3. 8、Struts2 运行流程分析

    1.流程分析: 请求发送给 StrutsPrepareAndExecuteFilter StrutsPrepareAndExecuteFilter 询问 ActionMapper: 该请求是否是一个 ...

  4. ASP.NET Web API是如何根据请求选择Action的?[下篇]

    ASP.NET Web API是如何根据请求选择Action的?[下篇] 再<上篇>中我们简单介绍了用于实现Action选择机制的HttpActionSelector,接下来我们来讨论本章 ...

  5. ASP.NET Web API是如何根据请求选择Action的?[上篇]

    ASP.NET Web API是如何根据请求选择Action的?[上篇] Web API的调用请求总是针对定义在某个HttpController中的某个Action方法,请求响应的内容来源于调用目标A ...

  6. ASP.NET Web API是如何根据请求选择Action的?[上篇] 【转】

    http://www.cnblogs.com/leo_wl/p/3316548.html ASP.NET Web API是如何根据请求选择Action的?[上篇] Web API的调用请求总是针对定义 ...

  7. ASP.NET Web API是如何根据请求选择Action的?[下篇] 【转】

    再<上篇>中我们简单介绍了用于实现Action选择机制的HttpActionSelector,接下来我们来讨论本章最为核心的内 容:ASP.NET Web API如何利用HttpActio ...

  8. action方法不返回

    当被请求的action方法中还有资源没有释放时,请求方法是不会返回的,会一直停留在方法中,即使是最后一行,因为请求方法一旦返回,那方法中的资源,引用就没有位置住了,所以所请求的方法会一直不返回,直到方 ...

  9. Asp.net mvc 中Action 方法的执行(一)

    [toc] 在 Aps.net mvc 应用中对请求的处理最终都是转换为对某个 Controller 中的某个 Action 方法的调用,因此,要对一个请求进行处理,第一步,需要根据请求解析出对应的 ...

随机推荐

  1. IOS基于XMPP协议开发--XMPPFramewok框架(一):基础知识

    最近蘑菇街团队的TT的开源,使我对im产生了兴趣,然后在网上找到了XMPPFramework进行学习研究, 并写了以下系列教程供大家参考,有写的不对的地方,请大家多多包涵指正. 目录索引 IOS基于X ...

  2. Strategy Execution with Strategy Maps and balanced score cards

    4 barriers for strategy execution: - vision barrier - people barrier - resource barrier - management ...

  3. [svc]jq神器使用

    jq神器 处理json数据 支持过滤某字段 支持数学运算(对字段处理) 安装 yum install -y jq 使用 参考: http://blog.just4fun.site/command-to ...

  4. 关于release后retainCount还是1的问题

    转自:http://www.cocoachina.com/bbs/read.php?tid=175523 realse之后再调用还能调用的的问题,我做了这么多年也是经常遇到,也曾经试图寻找原因, 就像 ...

  5. 对象.delegate=self的理解

    整理自:http://www.cocoachina.com/ask/questions/show/87430 各位大神,对象.delegate=self是啥意思,委托的意思不就是自己的任务交给其他人去 ...

  6. Hp && Dell服务器硬件监控

    HP 安装HP工具: yum install hpssacli 1 查看控制器状态 raid卡型号等hpssacli ctrl all show status 2 查看硬盘类型.大小 raid级别.状 ...

  7. 1. A + B Problem【easy】

    Write a function that add two numbers A and B. You should not use + or any arithmetic operators. Not ...

  8. 每日英语:Yahoo's Rally: Made in China

    The typical honeymoon doesn't last too long before the hard work of marriage begins. And so it norma ...

  9. js数组最大值和最小值计算

    基本概念 reduce() 方法接收一个函数作为累加器(accumulator),数组中的每个值(从左到右)开始缩减,最终为一个值. reduce 为数组中的每一个元素依次执行回调函数,不包括数组中被 ...

  10. 存档格式选择--JSON

    游戏里存档可以直接用lua,但是lua需要有一定编程基础:另外可以用ini,不过ini又太简单了,复杂的 格式无法用ini描述:还可以用xml,它的表达能力非常丰富,甚至有限数据库都用xml来作存储结 ...