Saturday, October 30, 2010

Ajax to JSR 168 Portlets


Good article on Best Practices for Applying AJAX to JSR 168 Portlets http://developers.sun.com/portalserver/reference/techart/ajax-portlets.html


Friday, October 29, 2010

JSR 286 Portlet filters


The new portlet filter functionality allows you to plug filters around any life-cycle call of the portlet. Following the common decorator pattern, filters can do pre- or post-processing, and they can modify or wrap the request and response objects that are passed to the portlet. Typical applications of portlet filters could include these:

Passing information from additional sources to the portlet as attributes or parameters
Output filtering for security enforcement or markup compliance
Collecting diagnostic information
Bridging between Web application frameworks, for example, uses a filter approach to augment the markup of portlets with additional semantic information for client-side click-to-action.

The portlet filter programming model is modeled on the servlet filter model:

Define the filters in the deployment descriptor. This definition is done using the element, where you also need to state the life-cycle call to which the filter should be applied.
Implement the corresponding Filter interface in your filter. You can also list multiple life-cycle entries and implement multiple Filter interfaces with your class.
Provide a filter-mapping element where you describe to which portlets your filter should be applied (you can also use an asterisk as a wildcard if it should be applied to all portlets in the application).
The order of the filter-mapping elements in the deployment descriptor also defines the order of the filters that are applied to the portlet.


Thursday, October 28, 2010

Inter Portlet Coordination with JSR 286


Coordination between portlets is a very common requirement. An example of information sharing between portlets can be a weather portlet displaying the weather information of a city and a map portlet displaying the location of the city. Since, both the portlets would be using the same zip code for a user, there should be mechanism provided by the portlal containers to allow portlets to share the zip code.

Prior to JSR 286, the support for inter portlet communication was rather minimal and information sharing between different portlets was accompalished primarily using application scoped session objects or vendor specific APIs. Both of above methods were rather problematic as in the former maintaining the uniqueness of the session attribute over a complex aaplication was a concern and in the later portability of the portlet was hampered. In order to provide coordination between portlets the Java Portlet Specification v2.0 (JSR 286) introduces the following mechanisms:

  1. public render parameters in order to share render state between portlets.
  2. portlet events that a portlet can receive and send.

Let's have a look how to use the above features.

Read More>>



What is a Portlet?


A portlet is a Web based component that will process requests and generate dynamic content. The end-user would essentially see a portlet as being a specialized content area within a Web page that occupies a small window in the portal page. Depending on the content nature of the Web site providing the portlet you could use this area to receive different types of information such as news, travel information, or even local weather. The portlet provides users with the capability to customize the content, appearance and position of the portlet.


JSR-168 Portlet Specification



JSR-286 Portlet Specification (Portlet 2.0)


JSR 286 Specification (Portlet 2.0) is available to download from the JCP website. Here is the direct link - http://jcp.org/aboutJava/communityprocess/final/jsr286/index.html


JSR 168 Tutorial - part I


What is JSR 168?

•From the portletdevelopment point of view, it is really very simple:

–You write a java class that extends GenericPortlet.

–You override/implement several methods inherited from GenericPortlet.

–You use some supporting classes/interfaces

•Many are analogous to their servletequivalents

•Some (portletsession) actually seem to be trivial wrappers around servletequivalents in Pluto.

Some Terminology

Portlet: Java code that manages a piece of web content and which may invoke services.

PortletContainer: Manages the lifecycle of the portlets (inits, invokes,destroys).

Portal: Displays the portal content provided by the container. The portal is responsible for the actual layout.

Portlet Application: A webappcontaining a group of related portlets, content, supporting jars, etc.