Tuesday, April 8, 2014

Introduction to JSR 286/ Portlet Specification 2.0

Introduction:

JSR 286 is advanced portlet specification and it was added new features to JSR 168.
We can also call Portlet Specification 2.0. Java Community People was founf some of the limitations in JSR 168 and they are added new specifications to JSR 168 then they released as JSR 286 standards.

We already know JSR 168 standard and Portlet Specification 1.0


In JSR 168 covers the basic portlet technology need and its specification later Java Community People was added more features and specification in JSR 286.

The following are important Specification and Features
  • Inter Portlet Communication
  • Another State in Lifecycle
  • Ajax Support
  • Serving Resources
  • Portlet Filter and Listeners
  • Support Many Web Application Frame works in Portal Container
  • Improve Cache Mechanism
  • Support for WSRP 2.0

Inter Portlet Communication

The important feature in JSR 286 is Inter portlet communication. Inter portlet communication is mechanism to send or receive data between two portlets.

We can achieve IPC with different ways in portlets and we can make communication between portlet which are in same page or other pages too. We will use different ways based on our requirement.

In JSR 168 IPC works between portlets which are in same page using Portlet Session Mechanism.

In JSR 286 they made communication between portlet which are in different pages using other mechanism

The following are new IPC mechanism added in JSR 286
  1. Events
  2. Public Render Parameters

Events:

Event based mechanism way to communicate between portlet which are in same or in other page too.

Here one portlet will send the event and other portlet will listen the event. Here another method added in lifecycle so that it send or publish the events and when page render respective listener portlets receive the dada or events. Here before portlet execute render phase it can send events to other portlets


Public Render Parameters

Public render parameters are another way in IPC. We will use some public render parameters to each portlet so that it will carry the data between portlet and it will available to other portlets.
We will define some public render parameter such a way it will available to other portlet to get the data from that.

Another State in Portlet Lifecycle

New lifecycle phase added in portlet lifecycle. In JSR 168 the state of transition change from Action Phase to Direct Render Phase no more states in between that.

In JSR 286 to implement IPC they will add another Lifecycle state that is called Events Phase.
Before transition from Action Phase to Render Phase portlet can send events to other portlet in Events phase. So that another  lifecycle phase was added for portlet so that it will send some events to other portlet.



 Ajax Support

JSR 286 support Ajax mechanism to communicate with server. This is one of the good features. Generally if any portlet is have in action page other portlet need to render the portlet within the page.

With the help of Ajax we can avoid render all portlets in page. We simply send Ajax call from portlet so that we can communicate with server then get the response.

Serving Resources

In JSR 168 portlet specification will render only HTML content in render phase it can’t render some resources like pdf, images and other content type.

In JSR 286 was added another feature called serving resources with help of this we can serve the images, pdf and other content types to client.

In the portlet interface they added new method called serveResource(----)  method so that It will serve the other content types to client. This method also used specially for Ajax call in portlet, to call this method we will use different URL i.e. serve recourse URL.

Generally in the portlet transition state will always change from Action Phase to Render Phase when we perform actions.

But when we call serve Resource phase it will directly serve the content and it won’t go to render phase.

Portlet Filter and Listeners

We can portlet related filters and Listeners in portlet portlet.xml file. This will add advantage to perform some events or some actions before portlet is rendered.

Support Many Web Application Frame works in Portal Container

Generally Portal specification is different and we will use portlet container to manage portlets and its lifecycle. But we have many elegant web application frameworks.

In JSR 286 support other web frame works to run in portlet container so that developer can develop portlet in any web application frame work and run in the portlet container with help of small changes. It will support JSF, Struts, Spring, Vaadin and other MVC bases frameworks.

Support for WSRP 2.0

The Web Services for Remote Portlets specification defines a web service interface for accessing and interacting with interactive presentation-oriented web services.

This will help us access portlet from remote location other portals. We need to deploy portlet in portal we simply use this protocol we can access other portlet which are in other portlet container.


Author

1 comment :

Recent Posts

Recent Posts Widget

Popular Posts