LRP-614 practice question 10 of 25
The recommended way to strip content from the outgoing response is to:
Full set: 144 questionsThe standard Java EE pattern for intercepting and modifying an HTTP request or response is a servlet filter. In the context of Liferay 6.1/6.2, the recommended and least invasive method to deploy a custom servlet filter is through a hook plugin. The hook's liferay-hook.xml descriptor file allows a developer to define a custom filter class and its URL mapping. Liferay then dynamically injects this filter into the portal's filter chain upon the hook's deployment. This approach provides the necessary functionality to "strip content" by wrapping the response object, without modifying Liferay's core source code or web.xml file, making it the preferred, modular, and maintainable solution.
A. Service post actions execute after a Struts action but before the JSP is rendered; they cannot access or modify the final, complete HTTP response stream.
B. An Ext plugin can achieve this but is considered highly invasive as it modifies core portal files. It is not the recommended way for tasks achievable with hooks.
D. A request post processor is a portal event handler. While it has access to the response object, a servlet filter is the standard, more direct pattern for modifying the response body.
1. Liferay Portal 6.2 Developer's Guide: In the chapter "Customizing Liferay with Hooks," the guide explicitly details how to implement custom servlet filters. It states, "You can use a hook to add a servlet filter to Liferay... To add a servlet filter, you need to specify the filter class and the filter mapping in your hook’s liferay-hook.xml file." This directly supports using a hook to implement a servlet filter. (Reference: Liferay Portal 6.2 Developer's Guide, Chapter 10: Customizing Liferay with Hooks, Section: "Application Adapter Hooks and Servlet Filter Hooks").
2. Liferay in Action (Manning Publications): While a commercial book, it is authored by a Liferay expert and reflects official best practices for the platform version. It describes hooks as the primary mechanism for customizations like adding servlet filters, contrasting them with the more heavyweight and discouraged Ext plugins. It reinforces that hooks are the standard for this type of customization. (Reference: Liferay in Action, by Rich Sezov, Chapter 13: "Customizing the Liferay Platform," Section 13.2.5: "Using hooks to insert servlets and filters").
Keep practicing
Take the free LRP-614 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other LRP-614 practice questions
- Question 1The best way to add a new language key to the portal is through:
- Question 2In a JSP that includes the tag, the method to check permissions is:
- Question 3A hook plugin can be used to: (Please select all correct answers.)
- Question 4An administrator would like to add a new travel preferences section in the Miscellaneous …
- Question 5The following statements about plugins are true: (Please select all correct answers.)
- Question 6All Service Builder entities contain a local reference to: (Please select all correct ans…
