• What are JSR and JCP?
• What is a Portlet as per JSR 168?
• JSR168 Specifications
- Portlet Lifecycle Methods
- Portlet Modes
- Portlet Window States
- Portlet Data Models
- Dispatching requests
- Caching and Security.
What are JSR and JCP?
JCP – Java Community Process
The international Java community develops and evolves Java™ technology specifications using the Java Community Process (JCP).The community is involved in the definition of future versions and features of the Java platform. Since its introduction in 1998 as the open, participative process to develop and revise the Java™ technology specifications, reference implementations, and test suites, the Java Community Process (JCP) program has fostered the evolution of the Java platform in cooperation with the international Java developer community.
JSR-Java Specification Request
A JSR is a Java Specification Request. This is the document submitted to the PMO (The Program Management Office is the group within Sun designated to oversee the Java Community Process and manage the daily running of the program. The actual development of the specification occurs within the Expert Groups.) by one or more members to propose the development of a new specification or significant revision to an existing specification.
Courtesy- http://www.jcp.org/en/introduction/faq
http://en.wikipedia.org/wiki/Java_Community_Process
What is a Portlet as per JSR 168?
• General Perception
– A portal is a webpage with many different links to various applications.
• Programmer’s View
– “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.”- JSR 168 spec
Now we must come across a series of questions..for better understanding.
A series questions (3W and 1H)
1. What is a Portlet?
2. What is Portal Page?
3. What is the difference between a portal page with many links and a portal page with portlets?
4. How is it different from a page with lots of links?
Portlet
• “A portlet is a Java technology based web component, managed by a portlet container, which processes requests and generates dynamic content.”
-- JSR 168 spec
• A portlet is itself an application having its own lifecycle.
Portlets and relationship with Portals
• “Portlets are used by portals as pluggable user interface components that provide a presentation layer to Information Systems.”
--JSR 168 spec
• So now we know how its entirely different from a website containing a lots of links apparently called portals
So it’s obvious that portlets are the basic building block of a successful web Portal where each portlet is assigned to do some specific task and the user is able to gather maximum information on a single page. The portal itself provides the user management capability and users have the facility to single sign on to use all the facilities provided by the entire portal. Personalization is also one of the most important features a portal provides. All these things are much more difficult and developed separately on a traditional portal page which is just a page with bunch of links. Ease of “plug in and run” concept and ease of removal from the portal page gives a new age portal a winning edge over traditional portals
JSR168 Specification
• Portlet Lifecycle Methods
• Portlet Modes
• Portlet Window States
• Portlet Data Models
Portlet Lifecycle Methods
This life cycle of a portlet is expressed through the init (), processAction(),
Render() and destroy() methods of the Portlet interface. The Portal calls the init() method to instantiate the portlet. Then the browser requests are handled by the portlet using ProcessAction() method if the request involves some kind of data processing. Else the render method takes care of it by rendering the page using either doView(),doEdit() or doHelp().Remember the render method is called whenever
a. the processAction() method is called by action request.
b. the renderRequest() comes into picture which doesn’t involve data processing.
c. any other portlet on the same portal page calls the render() method.
Portlet Modes
Generally a portlet has three modes
a. View mode –normal mode to show the content.
b. Help Mode –to show a help page about the application.
c. Edit mode –to show edit page for editing the portlet preferences.
d. But a portal can also have a “custom mode” if the manufacturer wishes to have.
Portlet Window States
• NORMAL
• MAXIMIZED
• MINIMIZED
• CUSTOM –based on manufacturer discretion.
Portlet Data Models
• Portlet to store view information in the “render parameters.”
• Session related information in “portlet session”
• User persistent data in the “portlet preferences”
Portlet Request Dispatcher
• It dispatches the request to other portlets or servlets using the Portlet request Dispatcher with the only Include () method.
Caching and Security
• Portlets that want their content to be cached using expiration cache must define the duration (in seconds) of the expiration cache in the deployment descriptor.
• Security constraints are a declarative way of annotating the intended protection of portlets. A constraint consists of the following elements:
- Portlet collection
- User data constraint
Can We Design a sample Portlet with the basic knowledge about portlets….???