concept Portlet interface in category java

appears as: Portlet interface, The Portlet interface, Portlet Interface
Portlets in Action

This is an excerpt from Manning's book Portlets in Action.

A portlet class must implement the javax.portlet.Portlet interface, directly or indirectly. The portlet API has a GenericPortlet abstract class that implements the Portlet interface and provides a default implementation for its methods. Developers will usually subclass the GenericPortlet class and override one or more methods to provide a specific implementation. The HelloWorldPortlet class is an example of a portlet class.

2.4.1. Creating portlets with the Portlet interface

The Portlet interface is at the heart of Java’s portlet technology, and it’s mandatory for portlets to implement it, either directly or indirectly. The Portlet interface methods are invoked by the portlet container to manage the lifecycle of a portlet instance. In this section, we’ll discuss the lifecycle methods defined by the Portlet interface and how some of the lifecycle methods relate to the portlet URLs (the portlet request types).

The lifecycle methods defined by the Portlet interface are init, processAction, render, and destroy. The Portlet 2.0 specification also introduced some optional life-cycle interfaces, EventPortlet and ResourceServingPortlet, which are covered in chapters 11 and 12.

Figure 2.8. Portlet lifecycle methods defined in the Portlet interface. An action request invokes the processAction method, followed by the render method. A render request invokes the render method. The timing of the init and destroy invocations depends on the portlet container implementation.