posts - 431,  comments - 344,  trackbacks - 0
关键字:   liferay    

// 初始化
portal.servlet.MainServlet.init()
 // process startup events
 StartupAction.run()

 // 初始化portlets.
 String[] xmls = new String[] {
  Http.URLtoString(ctx.getResource("/WEB-INF/portlet.xml")),
  Http.URLtoString(ctx.getResource("/WEB-INF/portlet-ext.xml")),
  Http.URLtoString(ctx.getResource("/WEB-INF/liferay-portlet.xml")),
  Http.URLtoString(ctx.getResource("/WEB-INF/liferay-portlet-ext.xml")),
  Http.URLtoString(ctx.getResource("/WEB-INF/web.xml"))
 };
 PortletLocalServiceUtil.initEAR(xmls)

 // 初始化display.
 String xml = Http.URLtoString(ctx.getResource(
   "/WEB-INF/liferay-display.xml"));
 PortletCategory newPortletCategory =
  PortletLocalServiceUtil.getEARDisplay(xml);
 portletCategory.merge(newPortletCategory);

 // 初始化layout模板.
 String[] xmls = new String[] {
  Http.URLtoString(ctx.getResource(
   "/WEB-INF/liferay-layout-templates.xml")),
  Http.URLtoString(ctx.getResource(
   "/WEB-INF/liferay-layout-templates-ext.xml"))
 };
 LayoutTemplateLocalUtil.init(ctx, xmls)

 // 初始化Theme.
 String[] xmls = new String[] {
  Http.URLtoString(ctx.getResource(
   "/WEB-INF/liferay-look-and-feel.xml")),
  Http.URLtoString(ctx.getResource(
   "/WEB-INF/liferay-look-and-feel-ext.xml"))
 };
 ThemeLocalUtil.init(ctx, xmls)

 // 检查company
 CompanyLocalServiceUtil.checkCompany(_companyId);

 // 其它内容...

// 响应服务
portal.servlet.MainServlet.service()
 
 // get portalContext
 ServletContext ctx = getServletContext();
 ServletContext portalCtx = ctx.getContext(
  PrefsPropsUtil.getString(_companyId, PropsUtil.PORTAL_CTX));
 
 // Struts module config
 ModuleConfig moduleConfig = getModuleConfig(req);

 // Portlet Request Processor - 在struts.config中定义.
 portletReqProcessor = PortletRequestProcessor.getInstance(this, moduleConfig);

 // 登录处理.

 // 处理service前置事件.
 EventsProcessor.process(PropsUtil.getArray(PropsUtil.SERVLET_SERVICE_EVENT_PRE), req, res);

 // 调用Struts的service方法.
 callParentService(req, res);

 // 处理Sruts后置事件.
 EventsProcessor.process(PropsUtil.getArray(PropsUtil.SERVLET_SERVICE_EVENTS_POST), req, res);
 
// struts的ActionServlet.
ActionServlet.process(HttpServletRequest req, HttpServletResponse res)
 processor.process(req, res);

// portal的RequestProcessor.
portal.struts.PortalRequestProcessor.process(HttpServletRequest req, HttpServletResponse res)
  
 // struts的RequestProcessor
 RequestProcessor.process(HttpServletRequest req, HttpServletResponse res)

  string path = processPath(req, res)  // PortalRequestProcessor重载

  ActionMapping mapping = processMapping(req, res, path);

  processRoles(req, res, mapping) // PortalRequestProcessor重载

  ActionForm from = processActionForm(req, res, mapping);

  processForward(req, res, mapping);

  processInclude(req, res, mapping);

  Action action = processActionCreate(req, res, mapping);

  ActionForward forward = processActionPerform(req, res, action, form, mapping);

  processForwardConfig(req, res, forward);  // TilesRequestProcessor重载
  
 // tiles的RequestProcessor
 TilesRequestProcessor.processForwardConfig(req, res, forward)

  processTilesDefinition(forward.getPath(), forward.getContextRelative(), req, res);

   Controller.execute();  // 输出/portal/layout.jsp


/html/portal/layout.jsp  - portal布局页面.
 
此处include在/portal-ejb/classes/portal.properties里layout.view.page定义的页面/portal/layout/view/portlet.jsp

/html/portal/layout/view/portlet.jsp  - portlet布局视图页面.

// 读取模板内容,模板由liferay-layout-templates.xml文件定义.
String content = LayoutTemplateLocalUtil.getContent(
 layoutTypePortlet.getLayoutTemplateId(), false, theme.getThemeId());
 下面是一个一列的模板:
 <div id="layout-content-outer-decoration">
 <div id="layout-content-inner-decoration">
  <div id="layout-content-container">
   $processor.processColumn("column-1")
  </div>
 </div>
 </div>

// 处理模板
portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(
  application, pageContext, request, response, content);
 

 // 注入模板处理程序
 TemplateProcessor processor = new TemplateProcessor(ctx, req, res, portletId);
 VelocityContext context = new VelocityContext();
 context.put("processor", processor); 
 // 处理模板
 Velocity.evaluate(context, pageContext.getOut(),
  RuntimePortletUtil.class.getName(), content); 

posted on 2007-01-28 09:59 周锐 阅读(956) 评论(1)  编辑  收藏 所属分类: Portal

只有注册用户登录后才能发表评论。


网站导航: