Created with Raphaël 2.1.0
Struts2核心时序图
url
url
StrutsPrepareAndExecuteFilter
StrutsPrepareAndExecuteFilter
PrepareOperations
PrepareOperations
ValueStackFactory
ValueStackFactory
OgnlContext
OgnlContext
ActionContext
ActionContext
ExecuteOperations
ExecuteOperations
Dispatcher
Dispatcher
ActionProxyFactory
ActionProxyFactory
DefaultActionInvocation
DefaultActionInvocation
ActionProxy
ActionProxy
1.doFilter()
2.setEncodingAndLocale()
3. createActionContext()
4.createValueStack()
5.putAll()
6.new ActionContext()
7.setContext()
8.wrapRequest()
9.executeAction()
10.serviceAction()
11.createActionProxy()
12.init()
13.execute()
14.invoke()
15.cleanupRequest()
注 4.创建值栈 5.初始化值栈中的map栈 6.将值栈放入到ActionContext中 7.把actionContext放入到了当前线程中
其中4-7是3方法的后续过程 3方法的作用创建了值栈,并初始化,并且吧OgnlContext放入到了ActionContext中,把ActionContext放入到了当前线程
12中: 1.createAction():调用了ObjectFactory中的buildAction方法创建actionStack.push(action) 把action入栈 2.contextMap.put(“action”,action),把当前的action对象放入到了map中 3.
List<InterceptorMapping> interceptorList = new ArrayList<InterceptorMapping>(proxy.getConfig ().getInterceptors ())
interceptors = interceptorList.iterator ()
获取这次请求的所有的拦截器,并且返回拦截器的迭代器形式
14: 执行顺序: 1.按照顺序的方法执行所有的拦截器 2.执行action的方法 3.执行结果集 4.按照倒序的方式执行所有的拦截器