ActionServlet : Struts1.3.8 Code Review [1]

1. org.apache.struts.action.ActionServlet
1.1  UnavailableException,指明Servlet与Filter永久或者暂时失效。
1.2  init(...)方法中内部方法细粒度化,方便重载。
1.3  Servlet的各种Scope中(如ServetContext,HttpSession等)的属性的键字的值使用包名:public static final String ACTION_SERVLET_KEY ="org.apache.struts.action.ACTION_SERVLET"; 
1.4  MessageResources使用工厂方法(Factory Method)模式 [1] 。其中
      抽象工厂(Creator)角色: MessageResourcesFactory
      具体工厂(Concrete Creator)角色: PropertyMessageResourcesFactory
      抽象产品(Product)角色: MessageResources
      具体产品(Concrete Product)角色: PropertyMessageResources
 
     对于ModuleConfig 和ModuleConfigFactory也有类似实现。
   
1.5 使用ServletConfig中的int-param.
      例如:value = getServletConfig().getInitParameter("convertNull");
1.6 获取web.xml配置信息。
      InputStream input =  getServletContext().getResourceAsStream("/WEB-INF/web.xml")
1.7 使用MessageResources获取本地化信息。
1.8 org.apache.commons.digester.Digester的使用
      参见另文: [2]
1.9 配置信息freeze的实现。
      使用标志位,如果改标志位设置了,那么所有对config的修改都回导致异常。
      struts中的实现中有级联的关系在。
1.10 使用了commons-chain: "Chain of Responsibility" pattern implemention.
1.11  资源释放。包括Log, chain.
      LogFactory.release(classLoader);
1.12  所有的ModuleConfig,RequestProcessor等在ServletContext中共用的资源,都放在ServletContext中。
 
遗留问题:
1.  convertNull什么意思?
 
参考:
[1]. [url]http://www.itlearner.com/article/2006/3159.shtml[/url]
[2]. [url]http://underpersimmon.blog.51cto.com/blog/170743/27868[/url]

你可能感兴趣的:(struts,职场,休闲)