`
xijunhu
  • 浏览: 152635 次
  • 性别: Icon_minigender_1
  • 来自: 无锡
社区版块
存档分类
最新评论

liferay-hook(二)

 
阅读更多

liferay-hook是否可以完全替代liferay-ext的调查

由于liferay-hook具有的热部署特性,而liferay-ext不行,部署完了,要重启tomcat.

 

先看liferay-hook的功能,1、liferay-hook可以重写jsp,这样liferay-hook代替liferay-ext的jsp的问题解决

2、liferay-hook可以添加event事件,即可以处理登陆前后或者其他地方需要保存参数,更改url等事件。主要继承

com.liferay.portal.kernel.events.Action;函数。

3、portal.properties,重写portal的部分配置,不是所有的配置都可以重写。event事件也可以写在这里面。

4、重写Portal Service,扩展包装类,重写包装类的一些方法。

5、重写Language.properties,即liferay国际化。

 

另外根据liferay-hook的dtd文档,liferay-hook.xml文件中还可以加servlet-filter,struts-action等标签。

主要研究了一下struts-action,从liferay官网上,找了一个sample,但是没有执行成功,他跟liferay-ext的struts1是完全不同的两个类,struts1继承的是struts1里面的action的类,而他是自己写的action类,然后进行了实现、继承。

 

然后再文档的ext插件部分,看到这么一段

The main use cases in which an Ext plugin may be needed are:
• Customizing portal.properties that are not supported by Hook Plugins

定制hook不支持的配置。


• Customizing Struts Actions

定制struts action(没有提到hook)


• Providing custom implementations for any of the Liferay beans declared
in Liferay's Spring files (use service wrappers from a hook instead
if possible)

提供任何liferay spring的中的bean 的实现(如果可能的话使用hook的service wrapper代替)


• Adding JSPs that are referenced from portal properties that can only be
changed from an ext plugin (be sure to check if the property can be
modified from a hook plugin before doing this)

添加跟properties关联的而且只能在ext下面更改的jsp文件(做这件事之前检查下属性是否可以在hook下修改)


• Direct overwriting of a class (not recommended unless it's strictly necessary)

直接重载liferay下面的class(如果不是特别需要,不建议这么做)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics