Posts

Showing posts from October, 2023

Liferay Glowroot Integration

Image
  Liferay Glowroot Integration How to configure and use Glowroot Application Performance Management (APM) tool in Liferay Overview Liferay Portal 7.4 GA100 comes bundled with a brand new feature -  Glowroot APM , a tool for monitoring and management of performance and availability of software applications. It provides a lot of features, such as: Trace capture for slow requests and errors; Continuous profiling (with very handy filtering); SQL capture and aggregation; Response time breakdown charts; Service call capture and aggregation; Responsive UI with mobile support; Configurable alerting and many others.  Glowroot is easy-to-use and very low overhead. By default, it's disabled in Liferay installation. This blog explains how to enable and use Glowroot APM.  Starting and using Glowroot Glowroot can be enabled during portal startup by passing "glowroot run" argument to catalina.sh startup script: Once portal is started - you can sign in as administrator ( by default:  te

Liferay Client-Side IPC

Image
Liferay Client-Side IPC How to implement Inter Portlet Communication on the Client Side Overview Widgets (portlets) in Liferay are usually dedicated to provide a separate piece of functionality: they can be placed onto a portal page, and work independently from the other widgets on the same page. But sometimes there are scenarios where one widget should react to the actions performed in another one. A typical example is search filters and search results: by applying a filter in the Search Filters widget the Search Results data should be updated according to selected filters. This kind of communication between portlets is called "Inter Portlet Communication" (IPC). IPC can be implemented in two ways: - Server-side, using the portlet events mechanism; - Client-side, using firing and listening to Javascript events; In this article you'll find how to implement IPC on the client side. Implementation For IPC implementation we'll use two portlets

Liferay AUI Form Submission

Image
   Liferay AUI Form with Multiple Actions  How to submit AUI Form to different actions using different submit buttons Overview Forms in Liferay are usually implemented using < aui :form tag. As default HTML form, it has the action attribute that defines the action URL to submit the form data to. Then you can use a submit button to submit data to the defined action. In most cases a single action is enough to submit the form, but sometimes you might need more complex scenario, where you need multiple actions to process data in a different way. Imagine a multi-step form with possibility to move to the next step, save draft form, or submit a form to review (on the last step): Each of the buttons should submit the form data, but the logic is different for each of actions: save data and move to the next step, save data and redirect to homepage, or submit data for review process. This articles explains how to handle cases like this. Solution To make it possible to submit forms to differen

Flatpickr Datepicker Integration for Liferay

Image
  Liferay Flatpickr Integration  How to integrate a custom Datepicker for Lifeary Overview Almost each website has a form where user needs to input the Date data - the date of birth, registration date, etc. Usually for such cases Datepicker components are used. Liferay has out-of-the-box date pickers, but each of them has its limitations: Liferay Datepicker ( < liferay-ui :input-date ) is deprecated already and has a legacy UI not compatible with modern Lexicon Design and Clay Components; Clay Datepicker is more visually appealing, but it does not have an appropriate component in the Clay Taglib - thus, can be used only inside React apps, and not in JSP code. Considering that, a 3rd-party Datepicker library can be used for displaying dates in Liferay. Flatpickr Integration There are a lot of JS libraries for Datepickers. The flatpickr one is a lightweight and dependency-free library with modern UI and lot of easy to use configuration options. To integrate Flatpickr you need to

UTF-8 encoding for Resource Bundle

Image
  Resource Bundle UTF-8 How to configure UTF-8 encoding for Resource Bundle Files in IDEA for Liferay Problem Sometimes you may see weird symbols in the User Interface, like these: This is usually caused by wrong character encoding, different from UTF-8. Solution If your labels are defined in the Resource Bundle (Language_XXX.properties files), which typically should be the case, you need to check the encoding configuration for properties files. Open the IDEA Settings and and navigate to Editor > File Encodings menu. Choose "UTF-8" for "Default encoding for properties files": Save the configuration, and redeploy module(s) with Resource Bundle. Now the labels from Resource Bundle properties files should display correctly. Enjoy 😏

Liferay NoSuchResourcePermissionException Error Fix

Image
  Permission Checking Error Fix How to fix "Someone may be trying to circumvent the permission checker" error in Liferay Overview Sometimes you may see notice strange errors on the portal related to permissions checking, similar to this one: 2023-10-10 07:37:39.152 ERROR [http-nio-8080-exec-1][MainServlet:1111] null com.liferay.portal.kernel.events.ActionException: java.lang.IllegalArgumentException: Someone may be trying to circumvent the permission checker: {companyId=224404, name=com.liferay.portal.kernel.model.Layout, primKey=9730, scope=4} This article explains how to find the reason and fix the issue. Problem If you check the stacktrace in more details - you'll see in the end, that the main reason is the missing ResourcePermission record for the resource on which permissions check is executed: Caused by: com.liferay.portal.kernel.exception.NoSuchResourcePermissionException: {companyId=224404, name=com.liferay.portal.kernel.model.Layout, primKey=9730, scope=4} at c