Rose手册第三章七节:controller层:门户必备portal支持

rose

3.7.1 什么是portal? --------------------

*字面意思,做门户用的。
*简单来说,把一个网页分成了N个区域,每个区域由不同的action去执行,多线程并行提高cpu使用率。

3.7.2 使用例子 -----------

*要使用portal,必须先在web.xml里声明所使用的线程池大小:

  1. <context-param>  
  2.         <param-name>portalExecutorCorePoolSize</param-name>  
  3.         <param-value>1024</param-value>  
  4. </context-param>  

*然后看示例代码:

  1. @Get("/3.7")  
  2. public String portal(Portal portal) {  
  3.     portal.addWindow("p1""/wp1");  
  4.     portal.addWindow("p2""/wp2");  
  5.     return "portal";  
  6. }  
  7.   
  8. @Get("/wp1")  
  9. public String portal1() {  
  10.     return "@this is p1";  
  11. }  
  12.   
  13. @Get("/wp2")  
  14. public String portal2() {  
  15.     return "@this is p2";  
  16. }  

*然后在第一个action中的portal.jsp中写到:

  1. <%@ page contentType="text/html;charset=UTF-8"%>  
  2. portal演示信息:  
  3. <br>  
  4. ${p1}  
  5. <br>  
  6. ${p2}  

*当我们部属好了之后,访问http://127.0.0.1/3.7
*将从浏览器中得到:
*portal演示信息:
*this is p1
*this is p2

3.7.3 这样子做的好处 --------------------

*更加充分地使用多核cpu。
*更加方便多人协作时对项目进行模块划分,搞的时候,按照url一分,一个url一个模块,>所有的页面都可以切成小的豆腐块,所以,你。

3.7.4 过去的经典事迹 --------------------

* 2010年的6月9日晚上7点"圣战"
* http://www.54chen.com/architecture/rose-open-source-portal-framework.html

[文中所提及代码均在 https://github.com/XiaoMi/rose/tree/master/rose-example 提供。]

常期更新版本在:https://github.com/XiaoMi/rose/tree/master/chapter_3_7


原创文章如转载,请注明:转载自五四陈科学院[http://www.54chen.com]

捐款订阅54chen
捐赠说明