深入浅出Liferay Portal (6)

【AAOS】【源码分析】用户管理(五)-- MUMD介绍 MUMD(多用户多屏显示)是Android Automotive OS为车载多乘员场景设计的功能,支持不同座位用户独立操作各自屏幕。 阅读详情

上回说到/c/portal/render_portlet请求经过MVC过程后会到达render_portlet.jsp。

render_portlet.jsp
-------------------------

Portlet portlet = (Portlet)request.getAttribute(WebKeys.RENDER_PORTLET);
cachePortlet = PortletInstanceFactory.create(portlet, application);
cachePortlet.render(renderRequestImpl, renderResponseImpl);

CachePortlet.render()

_invoke(req, res, false);
CachePortlet._invoke()
if (action)
  _portlet.processAction(...)
else
  _portlet.render(...);

//因为87 portlet是一个StrutsPortlet,在这里会调用StrutsPortlet.render()方法,由于StrutsPortlet和LiferayPortlet中都没有定义render()方法,最终调用的是GenericPortlet.render()方法。


GenericPortlet.render()

response.setTitle(getTitle(request));
doDispatch(request, response);

//由于LiferayPortlet中覆盖了doDispatch()方法,所以调用的是LiferayPortlet.doDispatch()

LiferayPortlet.doDispatch()

  if (mode.equals(PortletMode.VIEW)) {
    doView(req, res);
  }
  else if (mode.equals(LiferayPortletMode.ABOUT)) {
    doAbout(req, res);
  }
  else if (mode.equals(LiferayPortletMode.CONFIG)) {
    doConfig(req, res);
  }
  .......

//由于StrutsPortlet中重载了doView, doAbout等方法,所以调用的是StrutsPortlet中的各种doXXX()方法,下面以doView()为例
//另外有可能会有别的类型的portlet,例如liferay的JSPPortlet,从而会调用JSPPortlet.doXXX()方法。在JSPPortlet.doView中,调用include(viewJSP, req, res);而viewJSP = getInitParameter("view-jsp");所以在这个地方就可以把该JSPPortlet定义好的view.jsp直接include进来,没有如同StrutsPortlet的后续工作。

StrutsPortlet.doView()

include(req, res);

//StrutsPortlet中其他的doXXX()方法都会最后调用include()方法。

StrutsPortlet.include()

PortletRequestProcessor processor = _getPortletRequestProcessor(req);
processor.process(req, res);
PortletRequestProcessor.process(RenderRequest req, RenderResponse res)
//这里PortletRequestProcessor有两个process方法,一个处理RenderRequest,另一个处理ActionRequest。

HttpServletRequest httpReq = PortalUtil.getHttpServletRequest(req);
HttpServletResponse httpRes = PortalUtil.getHttpServletResponse(res);

process(httpReq, httpRes);
//由于PortletRequestProcessor和TilesRequestProcessor中都没有重载process(HttpServletReq, HttpServletRes),调用的是RequestProcessor的process()方法。

RequestProcessor.process(HttpServletRequest, HttpServletResponse)


String path = processPath(request, response); //这里是/layout_configuration/view
ActionMapping mapping = processMapping(request, response, path);
processForward(request, response, mapping)
processInclude(request, response, mapping)
ActionForward forward = processActionPerform(request, response, action, form, mapping);
……


protected void doInclude( String uri, HttpServletRequest request, HttpServletResponse response)
{
  RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
  rd.include(request, response);
}

portlet-custom.xml中定义了:
<portlet>
  <portlet-name>87</portlet-name>
  <display-name>Layout Configuration</display-name>
    <portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>
    <init-param>
      <name>view-action</name>
      <value>/layout_configuration/view</value>
    </init-param>
    .....
</portlet>

struts-config.xml中定义了action:

<action path="/layout_configuration/view" forward="portlet.layout_configuration.view" />

tiles-def.xml中定义了view.jsp:

<definition name="portlet.layout_configuration.view" extends="portlet.layout_configuration"> 
  <put name="portlet_content" value="/portlet/layout_configuration/view.jsp" />
</definition>

最后完成了万里长征,到达了/layout_configuration/view.jsp。

/layouot_configuration/view.jsp
-------------------------------------------

    <%
     PortletCategory portletCategory = (PortletCategory)WebAppPool.get(String.valueOf(company.getCompanyId()), WebKeys.PORTLET_CATEGORY);

     List categories = ListUtil.fromCollection(portletCategory.getCategories());

     Collections.sort(categories, new PortletCategoryComparator(company.getCompanyId(), locale));

     Iterator itr = categories.iterator();

     while (itr.hasNext()) {
      request.setAttribute(WebKeys.PORTLET_CATEGORY, itr.next());
     %>

      <liferay-util:include page="/html/portlet/layout_configuration/view_category.jsp" />

     <%
     }
     %>

/layouot_configuration/view_category.jsp
-----------------------------------------------------------

<%
itr2 = portlets.iterator();

while (itr2.hasNext()) {
  Portlet portlet = (Portlet)itr2.next();
  divId = new StringMaker();
  divId.append(newCategoryPath);
  divId.append(":");
  matcher = pattern.matcher(PortalUtil.getPortletTitle(portlet, application, locale));
  while (matcher.find()) {
    divId.append(matcher.group());
  }
%>

<div class="layout_configuration_portlet" id="<%= divId %>">
  <table border="0" cellpadding="2" cellspacing="0" width="100%">
    <tr>
      <td width="99%">
        <%= PortalUtil.getPortletTitle(portlet, application, locale) %>
      </td>
      <td align="right">
        <input type="button" value="<liferay-ui:message key="add" />"
         onClick="addPortlet('<%= plid%>', '<%= portlet.getPortletId() %>', '<%= themeDisplay.getDoAsUserId() %>');
         if (<%= !portlet.isInstanceable() %>) {
          var div = document.getElementById('<%= divId %>');
          div.parentNode.removeChild(div);
        };"
 >
      </td>
    </tr>
  </table>
</div>
<%
}
%>

在view_category.jsp中列出了每个category中所包含的portlet列表,一旦点击了"add"按钮,会调用addPortlet()方法在页面上增加一个portlet。在view_category.jsp中还实现了输入关键字对portlet进行过滤的功能。

ORACLE 12C RAC 启动报错,错误代码 ORA-27300,ORA-27301,ORA-27302 非一体机,12.2 无任何补丁,2套X86服务器,1节点集群异常(数据库正常,还有会话),2节点正常工作,负载不高,硬件、空间均未检查到异常,多路径存在掉线的情况,但通过Mulitpath -ll 看又是正常的,2根私有网络,其中一根不同,sysctl中配置的稀疏模式。5、再次加成crs alert ohas等集群日志,以及根据现象和错误再次到后台sr中查找可用信息,发现有一个类似问题,12.2 RAC 无任何补丁,报同样错误,解决方案为重启两套服务器。查询MOS文档以及后台文档,排除上面指出的问题。 阅读详情

相关推荐

定时移动鼠标点击鼠标,防止电脑息屏的vba脚本

定时移动鼠标,使系统始终处于激活状态,防止系统息屏。

panfei263031的博客 5946

Android Automotive 14(2) 多屏模拟器

Android Automotive 14(2) 多屏模拟器

阿坤iKun 4453

基于Simulink的永磁同步电机(PMSM)无位置传感器矢量控制与龙伯格观测器设计​

本文介绍了基于Simulink的永磁同步电机(PMSM)无位置传感器矢量控制方法,重点讲解了龙伯格观测器的设计与实现。主要内容包括:1)系统架构与数学推导,通过静止坐标系状态方程和极点配置构建观测器;2)Simulink建模步骤,从电机模型搭建到观测器核心代码实现;3)仿真结果对比分析,显示龙伯格观测器相比滑模观测器具有更好的平滑性和抗噪能力;4)工程部署建议,包括参数在线辨识、低速补偿策略和代码生成优化。该方法实现了全速域无感运行,稳态转速误差小于1%,为低成本高可靠性电机控制提供了有效解决方案。

amy_mhd的博客 172

Liferay layout_configuration 分析

当在Dockbar上点击Add->More...后,就进入了layout_configuration: 这也是一个portlet(Liferay内核中的一个特殊的portlet),portlet_id为87,参见liferay-portlet.xml: <portlet><portlet-name>87</p...

weixin_34240520的博客 165

ROS新手必看:5分钟搞定URDF小车建模(附Rviz可视化调试技巧)

本文为ROS新手提供了快速构建URDF机器人模型的实战指南。通过一个完整的两轮差速小车建模案例,详细解析了URDF的核心语法、Rviz可视化调试技巧以及常见问题排查方法,帮助初学者快速掌握ROS机器人建模与可视化调试的核心技能。

weixin_29079643的博客 252

STM32 RT-Thread 系统分析(1)- 启动文件

RT-Thread STM32 系统分析(1)- 启动文件前言基本信息前言说明三级目录 前言 基本信息 名称 描述说明 RT-Thread Studio 软件版本 版本: 1.1.3 RT-Thread 系统版本 4.0.2 STM32CubeIDE 软件版本 1.4.0 STM32芯片型号 STM32F013VG 前言说明 使用了STM32CubeIDE 和 RT-Thread Studio 建立了相同型号芯片的工程,对比其中启动文件内容差异如下: 左侧是RT-Threa

鸳鸯冰笔的博客 4103

Android 12系统源码_窗口管理(八)Configuration属性和WindowConfiguration属性

结合Android12系统源码介绍和Configuration类WindowConfiguration类,并具体分析该类的常见属性的来源。

AfinalStone的专栏 2802

基于Simulink的直流电机双闭环调速系统抗扰动仿真与参数优化

本文详细介绍了基于Simulink的直流电机双闭环调速系统仿真与参数优化方法。通过构建转速外环与电流内环的仿真模型,阐述了利用工程设计法整定PI参数的核心步骤,并重点探讨了如何优化系统参数以增强其抗负载突变等扰动的能力,实现快速、平稳的调速性能。

weixin_29061997的博客 206

fw面试折叠屏不会?一起来调研荣耀手机折叠屏原理

硬件层面:两块独立的物理面板(port=147 和 port=148)逻辑层面:Display ID 0/1 是固定编号,窗口和应用挂在逻辑 Display 上不动切换本质:物理面板在两个逻辑 Display 之间"交换",每次只有一个被设为 enabled活跃的标志不活跃的标志控制源头中的enabled属性 →→ 设置 layerStack + 开关设备App 感知:通过收到新的屏幕尺寸/density/挖孔信息,触发重绘。

learnframework的博客 4467

GOM引擎单机传奇架设全攻略——从DBC2000配置到登录器生成

本文详细解析了使用GOM引擎架设单机传奇的完整流程,从DBC2000的安装配置、服务端部署、引擎控制器设置,到登录器生成与客户端补丁放置。文章重点解决了单机架设中的常见问题,如数据库路径配置、IP地址设置及Key.lic文件处理,旨在帮助玩家快速搭建稳定的个人游戏环境,体验GM乐趣。

weixin_28318011的博客 665

【Windows Server 2019】企业虚拟专用网络服务的配置和管理(上)

博文介绍了部署企业虚拟专用网的定义,目的,以及好处。同时说明了实验拓扑图以及虚拟专用网络的工作原理。

VMware, Windows, Linux, Cisco, Container, Kubernetes, Kali 1万+

深入浅出Liferay Portal (2)

上篇讲到了安装JDK,ANT,JIKES,现在可以开始安装,配置,调试Liferay了。第 5 步 安装 Liferay Tomcat bundle将 liferay-portal-tomcat-5.5-jdk5-4.3.4.zip 解压到指定目录,如“D:/liferay/tomcat”,运行 bin 中的 startup.bat 就可以开启 tomcat 服务器,并且运行 liferay

未来为我而来 995

管好 SAP Fiori Launchpad Content:技术目录、业务目录与 KPI 工具的完整治理思路

SAP Fiori Launchpad 作为企业级统一入口,需通过技术目录(源对象)和业务目录(引用编排)分层治理。技术目录由 Launchpad App Manager 维护,负责应用描述对象(Tile 和 Target Mapping)的创建与管理;业务目录由 Launchpad Content Manager 编排,通过引用技术目录对象实现灵活配置。分析型内容则通过 F2814 统一管理。这种分层设计支持应用复用,便于升级维护,是 SAP S/4HANA 项目中实现高效内容治理的关键。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 144

深入浅出Liferay Portal (13)

1. 已有的Action分析观察Liferay Portal的源代码,可看到其中有一个目录为"portal-impl",进一步浏览到"portal-impl/src/com/liferay/portal/action",发现其中有一些重要的Action实现的源文件,如:LayoutAction.java, UpdateLayoutAction.java, RenderPortletAction

未来为我而来 607

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

深入浅出Liferay Portal (11)

类的层次关系MainServlet ActionServlet  HttpServlet   GenericServlet    ObjectPortalRequestProcessorPortletRequestProcessor TilesRequestProcessor  RequestProcessor   ObjectStrutsPortletJSPPortlet Lifer

未来为我而来 611

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

深入浅出Liferay Portal (3)

用户在地址栏键入http://localhost:8080/后,整个Liferay系统发生了些什么呢?1. 第一步,生成 http://localhost:8080/cRequest:   GET/HTTP/1.1Response:  状态:HTTP/1.1 200 OK内容:... ...解释:在web.xml中有关于首页的定义如下,也就是说当用户敲入http://localhost:

未来为我而来 770

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

深入浅出Liferay Portal (1)

安装文件及版本* JDK: jdk-1_5_0_14-windows-i586-p.exe* JIKES: jikes-1.22-1.windows.zip* ANT: apache-ant-1.7.0-bin.zip (在liferay portal 的 build-common.xml 中说明了要 1.7.0 以上)* LIFERAY: liferay-portal-tomcat-5.5

北冥有鱼 其名为鲲 化而为鸟 其名为鹏 2382

深入浅出Liferay Portal (4)

上一篇讲到当用户在浏览器地址栏上输入http://localhost:8080/后,经过几次迭代,服务器最终处理的是http://localhost:8080/c/portal/update,那当服务器收到/c/portal/update的请求后做了什么动作,最后是怎么向浏览器发送网页信息呢?1. 首先MainServlet接收这个请求,然后传递到LayoutAction。(具体怎么传递后续会

未来为我而来 820

深入浅出Liferay Portal (8)

tiles-def.xml------------------portal.jsp">    portal.jsp-------------- ">    ">      portal_normal.jsp" /> portal_normal.vm--------------------------$theme.include($top_head_include)#css ($c

北冥有鱼 其名为鲲 化而为鸟 其名为鹏 2149

深入浅出Liferay Portal (12)

谈了这么多,还没说怎么自己往Liferay中创建和加入一个portlet,Liferay中定义了几种类型的portlet,如JSPPortlet,StrutsPortlet,和VelocityPortlet。先以JSPPortlet为例说明吧。1. 定义新的JSP Portleta) 首先到 .../portlet/ext中去加入自己要创建的portlet文件夹,例如myappletpo

北冥有鱼 其名为鲲 化而为鸟 其名为鹏 1606
上一篇: 深入浅出Liferay Portal (5)
下一篇: 深入浅出Liferay Portal (7)
lybra
博客等级 码龄20年 41粉丝 100原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值