Friday

Portal.properties

 
Overview
One of the main virtues of Liferay is that, it is very configurable and the behaviour can be changed very easily by property file. The name of the property file is portal.properties, which governs the default behaviour of Liferay like whether user on first login should be shown terms of use page or not, which database to use and many more. This property file is bundled in a jar called portal-impl.jar which can be found in LIFERAY_HOME*/SERVER_HOME/ROOT/WEB-INF/lib folder.

How to Override?
This behavior is normally overriden by creating another property file named portal-ext.properties which is generally placed in classpath(LIFERAY_HOME/SERVER_HOME/ROOT/WEB-INF/classes) or in LIFERAY_HOME folder**.Any properties that are placed at these locations, have a general requirement to restart the server for the changes to take effect.

Some property values can be modified via hook too. The properties modified such does not need a restart. The list of properties that can be modified by a hook can be identified by the hook's dtd for a particular version. Following are the last two versions of hook dtd. Click on the link given below and save the file somewhere. You can then open the file using any text editor. Alternatively you can find all the dtds that liferay uses in  (LIFERAY_HOME/SERVER_HOME/ROOT/dtd)
It is generally a good practice to override the property using Hook if and where possible.

Word of Caution: Sometimes you may pull your hair figuring out why a certain property even though overridden by specifying a value in portal-ext.properties, does not show the effect. The reason is there are some properties which are initially read from the property file but are allowed to be modified by Liferay's UI. The values of such properties are stored in database and initial preference is given to read the value from database and if it is not found then Liferay decides to read the value from property file.

I believe that's all there is to know about portal.properties. If you find some information is lacking please let me know and I will update it.

You might be interested in
  • Overriding property using Hook (Will Add Content Later)
  • List of properties that may be modified by Liferay's UI(Will Add Content Later
*      LIFERAY_HOME is normally the folder the which contains server folder(tomcat)
**    You can also configure the property to be picked up from other locations as well, which I will show you later

No comments:

Post a Comment