Understanding a portal
By now, you have probably heard that "Liferay is a Portal Server"! Now the question is, "What do we really mean when we use the term Portal Server?"
Well, to get the answer we should first understand what a portal is. A portal is a web-based application or gateway which hosts and runs different applications required by the user. All these applications are integrated to achieve different benefits, such as availability of information at a central location, collaboration, reducing costs, and streamlining your business processes.
To make sure all of the above-mentioned benefits are achieved, Liferay Portal adds one or more applications on a portal page. This application is known as a portlet .
A portlet is a web application which runs in a fragment of a page. These portlets are used by portals as pluggable user-interface components which provide a presentation layer to the Information System. One or more portlets get combined and generate a complete web page or document, which is displayed to a user. This is known as aggregation. Liferay Portlet Container plays a vital role in achieving this. In the following screenshot, three portlets have been aggregated by the Portlet Container to form the welcome page:
The Portlet Container is a logical component in Liferay (and in any standard Portal Server) which runs the portlets and provides them with the required runtime environment. It is also responsible for managing the lifecycle of a portlet. To understand the role of the portlet container, let's look at what happens when you request to access a page in a portal:
- You send an HTTP request via a web browser to the portal.
- The portal receives the request.
- The portal determines if your request contains any action targeted to any of the portlets which are associated with the page.
- If there is any action involved, the portal requests Portlet Container to invoke that particular portlet to process the action. Rest of the portlet will only get re-rendered once the action phase of the portlet is completed.
- The Portlet Container provides the fragment of the individual portlet back to the portal. The fragment can be any markup (HTML/XHTML/WML).
- The portal aggregates the output of the portlets on the portal page and sends it back to the browser for you to access.
The lifecycle is explained in the following diagram:
Liferay Portal supports portlet standards JSR-168 and JSR-286, which are also known as Portlet 1.0 and Portlet 2.0 specifications, respectively.