问题描述
JSR 286规范是否要求包含Portlet的WAR中存在web.xml
文件?最初,我是这么认为的,但是后来我创建了一个不带web.xml
的portlet,将其部署在Liferay中,并且可以完美地工作.那么,它是Liferay的扩展(或错误),还是没有必要拥有这样的文件?
Does the JSR 286 spec require the presence of a web.xml
file in WARs containing portlets? At first, I thought so but then I created a portlet without a web.xml
, deployed it in Liferay and it worked flawlessly. So is it an extension (or a bug) of Liferay, or is it not necessary to have such a file?
推荐答案
正如Olaf正确地说的那样,portlet只是一个Web应用程序. Liferay具有一个侦听器,该侦听器在portlet自动部署时被触发.它爆发了战争,并添加了web.xml和必要的内容.您可以检查逻辑,如果您有来源.类名是PortletDeployer,方法是getServletContent.添加web.xml并将其填充后,他们只需使用FileUtil.touch对其进行触摸即可.
As Olaf rightly said portlet is nothing but a web application. Liferay has a listener that gets triggered when the portlet auto deploys. It explodes the war and adds web.xml and the content that is necessary. You can check the logic if you have source. The class name is PortletDeployer and the method is getServletContent. After add the web.xml and stuffing it, they just touch it using FileUtil.touch.
这篇关于JSR-286 Portlet的WAR文件中是否需要web.xml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!