Struts2 Request Process Procedure

Version=2.0.13, StrutsPrepareAndExecuteFilter

1. [StrutsPrepareAndExecuteFilter]
[StrutsPrepareAndExecuteFilter]doFilter(ServletRequest request, ServletResponse response,FilterChain filterChain);
1.1 [StrutsPrepareAndExecuteFilter]
prepare.findActionMapping(request, response);
1.2 [StrutsPrepareAndExecuteFilter]
execute.executeAction(request, response, mapping);
{PrepareOperations prepare, ExecuteOperations execute}


2. [ExecuteOperations]
[ExecuteOperations] .executeAction(request, response, mapping);
[ExecuteOperations] dispatcher.serviceAction(request, response, context,mapping);
{Dispatcher dispatcher,ServletContext servletContext}


3. [Dispatcher]
[Dispatcher].serviceAction(request, response, servletContext, mapping);
3.1 [Dispatcher] extraContext.putAttribute(“valueStack”,Request.getAttribute(“struts.valueStack”));
3.2 [Dispatcher] proxy=ActionProxyFactory.createActionProxy(namespace,name,method,Context);
3.3 [Dispatcher]
proxy.execute();
{ActionProxy proxy,ConfigurationManager configrationManager}


4. [StrutsActionProxy]
[StrutsActionProxy].execute();
4.1 [StrutsActionProxy] ActionContext previous=ActionContext.getContext();
4.2 [StrutsActionProxy] ActionContext.setContext(invocation.getInvocationContext());
4.3 [StrutsActionProxy] invocation.invoke();
4.4 [StrutsActionProxy] cleanupContext; ActionContext.setContext(previous);
{ActionInvocation invocation,ActionContext actionContext,Boolean cleanupContext}


5 [DefaultActionInvocation]
[DefaultActionInvocation].invoke(); ps:Iterator  interceptors
5.1 [DefaultActionInvocation] Interceptors.hasNext()=true;
interceptor.intercept(DefaultActionInvocation.this);
5.2 [DefaultActionInvocation] Interceptors.hasNext()=false;
resultCode = invokeActionOnly(); [system.exit(0)]
{Object action,ActionProxy proxy, Iterator interceptors}


6. [ExceptionMappingInterceptor]
[ExceptionMappingInterceptor].intercept(ActionInvocation invocation);
6.1 [ExceptionMappingInterceptor] do something about interceptor
6.2 [ExceptionMappingInterceptor] invocation.invoke();
{ActionInvocation invocation}


Procedure:
1.StrutsPrepareAndExecuteFilter.doFilter(ServletRequest,ServletResponse,FilterChain);
2.ExecuteOperations.executeAction(HttpServletRequest,HttpServletResponse,ActionMapping);
3.Dispatcher.serviceAction
(HttpServletRequest,HttpServletResponse,ServletContext,ActionMapping);
4.StrutsActionProxy.execute();
5.DefaultActionInvocation.invoke();
6.ExceptionMappingInterceptor.intercept(ActionInvocation);
7. DefaultActionInvocation.invoke();
8.AliasInterceptor.intercept(ActionInvocation);
9.DefaultActionInvocation.invoke(); ……. ……
n. DefaultActionInvocation.invokeActionOnly();
n+1. DefaultActionInvocation.invokeAction(Object,ActionConfig);
n+2.Method.invoke(Object,Object…); …………
n+m.SomeAction.execute();

你可能感兴趣的:(struts,dofilter)