Tuesday, March 8, 2011

Introduction of Portal and Portlets!

What Is a Portal?

A portal is a web based application that commonly  provides personalization, single sign on, content aggregation from different sources and hosts the presentation layer of Information Systems.

A portal may have sophisticated personalization features to provide customized content to users. Portal pages may have different sets of portlets to create content for different users.

Characteristics of Portal:

Web application which aggregates different applications into one page with a common look and feel for the portal user.

Client request is processed by the Portal Web application, which retrieves the portlets on the current page for the current user. The Portal Web Application, i.e. the front-end servlet, then calls the Portlet Container for each portlet to retrieve its content through the Container Invoker API.

What Is a Portlet?

A portlet is a Java technology based web component, managed by a portlet container, that processes requests and generates dynamic content. Portlets are used by portals as pluggable user interface components that provide a presentation layer to Information Systems.

The content generated by a portlet may vary from one user to another depending on the user configuration for the portlet.

What is Portlet Container?

A portlet container runs portlets and provides them with the required runtime environment. A portlet container manages the portlet lifecycle. It also provides persistent storage for portlet preferences. A portlet container receives requests from the portal to execute requests on the hosted portlets.A portlet container is not responsible for aggregating the content produced by the portlets. It is the responsibility of the portal to handle the aggregation.

A portal and a portlet container can be built together as a single component of an application suite or as two separate components of a portal application.

Portlet lifecycle

The basic portlet lifecycle is to:

  1. Initialize, using the init class to initialize the portlet and put it into service.
  2. Handle requests, processing different kinds of actions and rendering content.
  3. Complete, using the destroy class to take the portlet out of

The portlet receives requests based on the user interaction with the portlet or portal page. The request processing is divided into two phases:

  • Action processing

If a user clicks on a link on the portlet, an action is triggered.The action processing must be finished before any rendering of the portlets on the page is started. In the action phase the portlet can change the state of the portlet.

  • Rendering content

In the render phase, the portlet produces its markup to be sent back to the client. Rendering should not change any state. It allows a page re-fresh without modifying the portlet state. Rendering of all portlets on a page can be performed in parallel.

Request flow from client to portlets

Scope of JSR 168

What does JSR 168 define ?

  • Portlet API and Portlet Container
  • Contract between the API and the container
  • Deployment unit: portlet application

What is out of scope of JSR 168 ?

  • Aggregation, layout management
  • Page personalization and configuration engines
  • Portal administration and configuration

Portlet modes:

Portlet API defines the following portlet modes:

  • Edit – To display one or more personalization views that let the  user personalize portlet settings.

  • Help – To display help views.

  • View – To display the portlet output.

  • Configure – To display one or more configuration views that let administrators configure portlet settings valid for all users.

portal vendor specific modes that are available only in a portal of a specific vendor

Portlet Window state:

  • Normal – To indicate that the portlet is sharing its screen with other portlets on a page.

  • Minimized – To indicate that the portlet is minimized and cannot render any output.

  • Maximized – To indicate that a window has more real estate to render its output then in normal window state.

In addition the these window states, JSR 168 allows the portal to define custom window states

For More Inform Check this link

New JSR 286 features

Portlet coordination(Inter Portlet Communication)

  • Portlet events
  • Public render parameters

Resource serving

  • Portlet acts as a proxy to a resources, e.g. PDF documents.
  • Portlet has full control over the output stream (no portal aggregation)
  • creating images and other binary resource dynamically.
  • Returning XML, JSON, HTML and  fragments for AJAX calls.
  • Introduction of a new URL type, resource URLs.
  • lifecycle method on the serveResource Resource URLs trigger the Resource Serving Portlet interface.
  • Allows better AJAX support


Portlet Events

Loosely coupled publish/subscribe model

  • Does not require that the different portlet developers know about each other’s work Events are send and received during action phase.
  • At development time define the date that a portlet understand in the portlet.xml and implement the event specific methods in the portlet class
  • At development time create the action connections between the portlets

Event flow