LRP-614 practice question 23 of 25

In portal.properties: login,events.post=\ com.liferay.portal.events.ChannelLoginPostActionA,\ com.liferay.portal.events.Defaultl_andingPageAction,\ com.liferay.portal.events.LoginPostAction A hook plugin can insert a new class between DefaultLandingPageAction and LoginPostAction.

Full set: 144 questions
Answer options
A: True
B: False
Correct Answer:
TRUE
Explanation

A hook plugin can indeed achieve this outcome. The mechanism for this is overriding the portal property. A hook can contain its own portal.properties file. When the hook is deployed, any properties defined in its portal.properties file will override the default values from the portal's core configuration. To insert a new class, the developer would copy the original value of login.events.post into the hook's portal.properties file and then add the fully qualified class name of their new action class at the desired position in the comma-separated list. The portal will then use this new, complete list, effectively "inserting" the new action into the post-login event chain.

Why Incorrect

The "False" option is incorrect because this is a standard and documented customization pattern in Liferay. While the underlying mechanism is a full replacement of the property's value rather than a dynamic, partial insertion, the functional result is that a new class is executed between the existing ones. The question asks if it can be done, and the answer is yes, via a portal properties hook.

References

1. Liferay Portal 6.2 Developer's Guide: Chapter 7, "Hooks," in the section "Customizing Portal Properties." This section explains that a hook can include a portal.properties file to override default portal properties. It states, "To customize portal properties with a hook, you need to create a file named portal.properties in your hook’s docroot/WEB-INF/src directory... When you deploy your hook, the properties you’ve specified in your hook’s portal.properties file will override the values in Liferay’s portal.properties file." This confirms the mechanism used to achieve the described outcome.

2. Official Liferay Documentation (Developer Network for 6.1/6.2): The tutorial "Overriding and Adding Portal Properties" describes the process. It details creating a portal.properties file within a hook plugin to set new values for existing portal properties. For list-based properties like login.events.post, the documentation shows that the entire list must be redefined in the hook's properties file, which is how an "insertion" is accomplished. (Reference to Liferay Developer Network tutorials for Liferay Portal 6.1/6.2).

Scroll to Top