Liferay 7 Interview Questions
Following are some of the most frequently asked Liferay interview questions in the interview, here are the answers for them.
What is a Liferay Portal?
In general, a web portal represents a web application that provides a single point of access to variety of information.
Functionality of a portal can extended very easily by creating custom applications that can run inside a portal. These applications are called portlets.
For running portlets you need application server that can run a portlet container spec (JSR168 or JSR286). There are dozens of free and enterprise portal products available.
Liferay portal is an open source portal and below are the benefits of using Liferay portal:
- Content management system (Documents, Articles).
- 2-stage, 3-stage workflows and publishing.
- Social networking. 4) Sites and organization basis pages.
- Integration with third party like LDAP, Solr, SSO(CAS, Siteminder).
- Portlets realted to Wiki’s, News, Finance, Social, Workflow, Collaboration.
- Compatible with different Operating systems, databases and APP servers.
- Compatible with UI technologies and web services.
- Compatible with different scripts like PHP, Ruby, Grails, Python.
- Suppport of hot deployment feature.
What is a Portlet?
Liferay portal comes with different portlets by default. These portlets are nothing but different small applications running in the instance (portal). Portlets are pluggable software components that are managed in a web portal.
In general words you can call them as different catalogues as portlets produce fragments of markup code that are aggregated into a portal. So a portal page is displayed as a collection of portlet, these multiple small applications together making a page of the site and these all pages together makes one community or enterprise portal. Hence a portlet (or collection of portlets) resembles a web-based application that is hosted in a portal.
Portlet is a small application to fulfill the requirement of certain domain. Inter portlet communication is supported under Liferay portal. Portlet support hot deployment feature of Liferay Portal.
What is Liferay portal and how it differs from other portals IBM WCM,Web logic?
- Liferay Portal is platform contains common applications used to create web application
- Liferay provides a development framework with highly customization components for building a site.
- Liferay Portal can be used for content management, be it web content management
- Liferay Portal offers a rich collaborative application suite with:
- User Management
is Liferay is JSR-168 compliant or JSR-286?
JSR – 286
Which all methods JSR-286 supports?
Which JSR-286 portlet class extends?
What class LiferayMVCPortlet extends?
LiferayPortlet -> GenericPortlet
What are the differences between Portlet and Servlet?
A Portlet container is built on top Servlet container.
What is the difference between a Liferay Hook and Liferay EXT?
Hook: Hooks is a feature to catch hold of the properties and JSP files into an instance of the portal as if catching them with a hook. Hook plugins are more powerful plugins that come to complement portlets, themes, layout templates, and web modules. A hook plugin is always combined with a portlet plugin. For instance, the portlet social-portlet is a portlet plugin for Social Office with hooks. In general, hooks would be very helpful tools to customize the portal without touching the code part of the portal. In addition, you would use hooks to provide patches for the portal systems or social office products.
Source: Liferay Portal 6 Enterprise Intranets
EXT: EXT is used to customize and extend the Liferay portal. EXT builds a new ROOT webapp and replaces by a huge build mechanism your existing Liferay portal.
The Liferay EXT Environment is where you would ideally make changes to the portal itself. In other words, this is where you customize or “extend” the portal. You may ask, “Why can’t we just make the changes to the portal source directly?” The answer is that you technically CAN, but if and when you have to upgrade, you will have a tough time sorting out what is out-of-the-box and what is customized. EXT Environment keeps things separate.
What is the difference between view and edit modes of a portlet?
View mode is what is displayed a user logs in to the liferay portal and various portlets are displayed to him.
Edit mode is the configuration options that are displayed when the edit button is clicked on the portlet.
What is service.xml and how will you use Liferay service builder?
service.xml is a configuration file which consists the details for database entities that are used in a portlet. The service builder uses the service.xml to generate the DAO/DTO classes for a portlet.
service.xml is also used by the Liferay server to create the database tables and columns for entities mentioned in service.xml.
Can I run my Struts 1.3 based legacy application as a portlet application? How?
Yes it is possible to convert legacy application into a portlet by making the legacy application to follow the requirements of a Liferay plugin and then deploying the same on Liferay server.
Do you know how to update your setup of Liferay 5.2.3 to Liferay 6?
Liferay website itself lists the steps for upgrading from 5.2.3 to Liferay 6. One should be though aware of how to take database backup and how to patch Liferay in general.
What all other portals have you heard of? How do you compare them to Liferay?
Other vendors have also rolled out portals which are reference implementation of JSR 286. The list includes:
- Apache JetSpeed
- JBoss GateIn
- Oracle WebLogic Portal
- IBM Websphere Portal
- SAP NetWeaver
What is a Portlet Lifecycle?
Following is the portlet lifecycle:
Init(): It mainly initializes the portlet.
Render(): It takes the HTML output to User Interface. It mainly render the view in term of JSP/HTML code and show into the respective portlet.
Destroy(): This method takes care of releasing the portlet resources.
What Is A Liferay Portal Instance?
Liferay portal ships with the one liferay portal tomcat bundle which is up and running in any server with certain database settings. We can have more than one liferay instances running from one database.
Liferay Portal allows you to run more than one portal instance on a single server. The Portal Instances page of the control panel lets you manage these instances. Data for each portal instance are kept separate. All portal data, however, is kept in the same database.
Each portal instance requires its own domain name. Liferay will direct users to the proper portal instance based on this domain name. So before you configure an instance, we need to configure its domain name in our network first. When we are ready to add an instance, click the Instances tab – > Add button.
It will be prompted for four fields and a check box:
- Web ID: A general convention is to use the domain name for this. It’s a user-generated ID for the instance.
- Virtual Host: Put the domain name you configured in your network here. When users are directed to your Liferay server via this domain name, Liferay will then be able to send them to the proper portal instance.
- Mail Domain: Enter the domain name for the mail host for this instance. Liferay will use this to send email notifications from the portal.
- Max Users: Enter the maximum numbers of user accounts you would like your portal instance to support.
- Active: Use this check box to choose whether to create an active or an inactive portal instance.
How Can I Configure Two Different Domain Names (e.g. First.example.com And Second.example.com) On Liferay?
At the time of creation of any site we need to provide domain names which further take it as site domain name. We need to provide the certain domain name as required through the control panel of liferay portal. Single instance of Liferay Portal supports hosting of two or more domain names via communities(sites).
When we will go to control panel -> Site settings -> we can provide the site URL, details like site(community) description, membership type, active status and virtual host.
Which One Is Best To Start In A Clean Setup?
Liferay bundle with tomcat app server is the best one to start in a clean setup.
Liferay Portal Interview Questions
How Can You Customize Liferay Search Feature? What Are The APIs To Do It?
We can customize Liferay Search feature, depends upon our requirement by below two ways.
Hook: If changes are required as per the view side like we need to change the search result from view then we can write the Hook to customize it.
EXT: If changes are required as per the core functionality like we need to change the search query term, we can implement EXT.
How To Setup A Liferay Cluster From Scratch?
We need to setup below properties in our portal-ext.properties(this is for one instance represented by 1p, same properties we need to add for second instance also represented by 2p) and some required IP addresses.
#cluster configurations - these settings are for cluster net.sf.ehcache.configurationResourceName=/myehcache/hibernate-clustered.xml dl.store.file.system.root.dir=/webapps/document_library_cluster #other settings for cluster liferay.home=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/ lucene.dir=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/data/lucene cluster.link.enabled=true lucene.replicate.write=true multicast.group.address["cluster-link-control"]=188.8.131.52
What is Use of <portlet:defineObject> and <liferaytheme:defineObject>?
These are liferay tag libs and provide access to below list of objects in JSP:
- portlet:defineObject will provide following variables
- renderRequest and renderResponse
- actionRequest and Response
- eventRequest and Response
- resourceRequest and Response
liferay-theme:defineObject will provide following variables
Explain IPC(Inter portlet communication)?
- Portlet 1.0 did not offer any standard method for portlets to communicate with each other
- Portlet 2.0 (JSR – 286 ) addresses this issue with 2 different mechanisms for IPC.
- Public Render Parameters
- Portlet Events
What is the use of the PortletPreferences interface?
Portlet Preferences are properties for storing basic portlet configuration data. Administrators often use preferences to provide a customized view of a portlet to users based on preferences.
In Portlet URL, what is p_p_lifecycle?
p_p_lifecyle holds integer value and represents the portlet lifecycle phase that portlet belongs:
- 0 means render phase
- 1 means action phase
- 2 means server resource phase.
What is Portlet Name space and why it is important ? how do you get portlet namespace in JSP?
- Portlet namespace is portlet Id
- p_p_id parameters also contains portlet namespace
- portlet name space is prefixed with url parameters, so that portlet container will identify the parameters belongs what portlet
- In JSP:
<% String nameSpace= getNamespace() %>