Reputation: 1477
I need to define some custom properties in an hook (e.g. myhookname.myproperty
) and read them in my hook Java classes.
I know I can't create a custom property file (because it will be deploied in the hook's webapps dir, but hook will "live" in the ROOT context)... so the only idea seems to add new properties in portal-ext... But, in this way, the hook deploy can't be consistent (because it needs for a modification of portal-ext).
What is the Liferay way to do this? Do you have other idea to achieve my needs?
Thanks
Upvotes: 4
Views: 2373
Reputation: 2862
See Extending and Overriding portal.properties in Liferay 6.2 Developer's Guide.
How to:
portal-hooked.properties
file in the classpath root of your hook (ie. src/main/resources in case of Maven built project). Let's assume the file will contain my.custom.property = Aha
definition.liferay-hook.xml
:<hook>
<portal-properties>portal-hooked.properties</portal-properties>
</hook>
com.liferay.portal.kernel.util.PropsUtil.get("my.custom.property")
.Upvotes: 4