The diagram describes the framework's architecture.

In the diagram, an initial request goes to the Servlet container
(such as Jetty or Resin) which is passed through a standard filter
chain.
這個圖中,初始需求到了Servlet容器,通過了標準的filter鏈。
The chain includes the (optional) ActionContextCleanUp filter, which is useful when integrating technologies such as SiteMesh Plugin.
這個鏈包括ActionContextClean的filter,它在整合技術方面例如:SiteMesh插件非常有用。
Next, the required FilterDispatcher is called, which in turn consults the ActionMapper to determine if the request should invoke an action.
接著,FilterDispatcher被調用,它查詢ActionMapper決定請求應該調用action。
If the ActionMapper determines that an Action should be invoked, the FilterDispatcher delegates control to the ActionProxy. The ActionProxy consults the framework Configuration Files manager (initialized from the struts.xml file). Next, the ActionProxy creates an ActionInvocation, which is responsible for the command pattern implementation. This includes invoking any Interceptors (the before clause) in advance of invoking the Action itself.
如果ActionMapper決定Action應該被調用,FilterDispatcher把控制委托給ActionProxy。ActionProxy咨詢配置文件管理器(從struts.xml文件初始化)。接著,ActionProxy創建一個ActionInvocation,它負責命令格式實現,包括在調用Action自己前面調用任何Interceptors。
Once the Action returns, the ActionInvocation is responsible for looking up the proper result associated with the Action result code mapped in struts.xml. The result is then executed, which often (but not always, as is the case for Action Chaining) involves a template written in JSP or FreeMarker to be rendered. While rendering, the templates can use the Struts Tags
provided by the framework. Some of those components will work with the
ActionMapper to render proper URLs for additional requests.
一旦Action返回,ActionInvocation負責查詢在struts.xml中映射的關于Action Result code相關的合適的result,它一般調用JSP或FreeMarker模板做渲染。在渲染的時候,模板可以用Struts標簽。部分組建將和ActionMapper工作來渲染合適的URL給請求。
 |
All objects in this architecture (Actions, Results, Interceptors, and so forth) are created by an ObjectFactory.
This ObjectFactory is pluggable. We can provide our own ObjectFactory
for any reason that requires knowing when objects in the framework are
created. A popular ObjectFactory implementation uses Spring as provided
by the Spring Plugin. |
Interceptors are executed again (in reverse order, calling the after clause).
Interceptor以相反的順序在執行一遍。
Finally, the response returns through the filters configured in the web.xml. If the ActionContextCleanUp filter is present, the FilterDispatcher will not clean up the ThreadLocal ActionContext. If the ActionContextCleanUp filter is not present, the FilterDispatcher will cleanup all ThreadLocals.
最后通過在Web.xml中配置的filter返回響應。如果ActionContextCleanUp過濾器也用了,那么FilterDispatcher不清理ActionContext本地線程。否則FilterDispatcher清理所有的本地線程。