Http://struts.apache.org/docs/big-picture.html
1. HttpServletRequest through each filter to reach Filterdispatcher (this is no longer used, now use Strutsprepareandexecutefilter)
2. Execute the Dofilter method, if the pattern does not match, then go to the next filter chain
3. Create context if match (create instance for each request, thread safe)
4. Determine if the action should be invoked according to Actionmapping
5. Delegate control to Actionproxy if you need to invoke the action
Public voidDoFilter (servletrequest req, servletresponse Res, filterchain chain)throwsIOException, servletexception {httpservletrequest request=(httpservletrequest) req; HttpServletResponse Response=(HttpServletResponse) res; Try { if(Excludedpatterns! =NULL&&prepare.isurlexcluded (Request, Excludedpatterns)) {Chain.dofilter (request, response); } Else{Prepare.setencodingandlocale (request, response); Prepare.createactioncontext (request, response); Prepare.assigndispatchertothread (); Request=prepare.wraprequest (Request); Actionmapping Mapping= prepare.findactionmapping (Request, Response,true); if(Mapping = =NULL) { Booleanhandled =execute.executestaticresourcerequest (request, response); if(!handled) {Chain.dofilter (request, response); } } Else{execute.executeaction (request, response, mapping); } } } finally{prepare.cleanuprequest (request); } }
View Code
6. Querying the configuration file
7. Create the actioninvocation, which has the following relationship to the Interceptor:
/** * Override to handle interception */public abstract Throws Exception;
8. Call the interceptor stack, action class
9. Action returns the result, it is possible to render a template such as JSP, which will initiate additional requests
10. Call Interceptor Stack after rendering
HttpServletResponse through the filter.
The client gets a response
Apache Struts 2 Documentation Big picture