Posts

Liferay Core JSP Override

Image
Liferay Core JSP Override Core JSP Override Using Custom JSP Bag Overview We often need to customize the portal appearance. For styling customization we can use custom themes or style books, for business-logic adjustments - service wrappers or portlet filters. But when we need to change what is displayed on the page (make changes to the markup itself) - we need to override the portal JSP files. Fortunately, there are extension points for this. For core JSPs we can use a Custom JSP Bag.  What is a Core JSP? Liferay 7 has a modular architecture.  Previously (Liferay 6.2 and below versions) had a monolith one: Liferay was a single web application deployed to webapps/ROOT. All the JSP files were stored in webapps/ROOT/html folder. For these JSPs customization there was a “JSP hook” approach.  In Liferay 7 most of these JSPs were moved to separate modules. Remaining JSPs, which are still inside webapps/ROOT/html folder are considered as “Core JSPs”: For these JSPs...

Liferay Service Wrappers

Image
Liferay Service Wrappers How to override Liferay Services Overview Sometimes you may need to customize logic for a particular Liferay service. For some cases, when certain additional operations need to be performed on an entity itself, the Model Listener approach can be used. In other situations, when the service business-logic needs to be changed - Service Wrapper is a proper solution. What is a Service Wrapper? Service Wrapper is an extension point provided by Liferay to inject custom logic for Liferay services. As it’s clear from the name - Service Wrappers “wrap” Liferay Services and provide additional functionality on top of them.  There is a ServiceWrapper interface with methods to set and get the wrapped service. Service Builder generates basic service wrapper implementations for each entity (both for local and remote services). For example, for User there are UserServiceWrapper and UserLocalServiceWrapper . These classes contain the default implementatio...