首页 > IT职业 > IT图书 > Liferay 启动过程分析
前几天搞了一个BUG,吧精力耗尽,也激发了我对Liferay这个框架内部的探究欲望。所以这几天端午节准备对Liferay框架启动过程进行深入研究,来满足自己的好奇心。
当我们在地址栏中访问http://localhost:8080时,因为Liferay应用本质上也是一个web应用,所以它会去找ROOT应用的web.xml,因为定义了
index.html index.jsp
所以,它会去找index.jsp:
..." http-equiv="refresh" /> ')">
其中,最值得看的就是
然后找到并替换之后,去执行PropsUtil.get("portal.ctx");
public static String get(String key) { return _instance._get(key); }
它会访问
private String _get(String key) { return _getConfiguration().get(key); }
这段代码最终会访问配置文件,然后读取key-value对到Configuration中,我们在portal.properties中找到了portal.ctx的定义:
##
## Portal Context
##
#
# Specify the path of the portal servlet context. This is needed because
# javax.servlet.ServletContext did not have access to the context path until
# Java EE 5.
#
# Set this property if you deploy the portal to another path besides root.
#
portal.ctx=/
所以portal.ctx=/
解析PATH_MAIN:
它在Portal接口中有定义:
public static final String PATH_MAIN = "/c";
所以综上所述,在PortalImpl构造器中的_pathMain = _pathContext + PATH_MAIN="/"+"/c"="//c"
它就是的值。
所以当index.jsp中DOM树加载完毕之后,它会去执行:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3407/viewspace-2814984/ ,如需转载,请注明出处,否则将追究法律责任。