Understanding the Portlet Container 1.0 Beta Software and Deploying Portlets

   
By Deepak Gothe, December 14, 2006; updated May 4, 2007  

This article describes the Portlet Container 1.0 Beta software that ships with the Java Application Platform SDK Update 2, including the deployment and undeployment of portlets using the Portlet Container.

Note: Also see the Portlet Container 1.0 Beta Release Notes and Installation Instructions for Java Application Platform SDK Update 2, and an associated screencast.

 

Contents
 


 
Overview

The Java Portlet Specification ( JSR 168) is a standard for developing portal components with the Java programming language. The Portlet Container 1.0 Beta software that is part of Java Application Platform SDK Update 2 not only implements the Java Portlet Specification, but also provides a portlet driver, a lightweight portlet rendering environment. This driver simulates some capabilities of a typical portal product (like the Sun Java System Portal Server). This Portlet Container 1.0 Beta software also provides an extension to the standard Java Portlet allowing Inter Portlet Communication, a Portlet Specification 2.0 feature ( JSR 286).

In the future, the Portlet Container will provide Portlet 2.0 implementation when available.

This article provides an introduction to the Portlet Container in Java Application Platform SDK Update 2. First, you get an overview of the basic architecture (Note: This architecture may change in future updates of Portlet Container), and then you see how to deploy a portlet.

Figure 1 depicts the basic architecture. The Portlet Driver processes the client request, retrieves the portlets to be displayed, and then calls the portlet container to retrieve each portlet's content. The Portlet Driver accesses the Portlet Container with the Container API. The Portlet Container is composed of two major components: a portlet container component and a portlet application engine component. The portlet container component is only responsible for gathering preference and data from the portal and handling caching. The remainder of the work of providing an execution environment is delegated to the portlet application engine component. Finally, the portlet application engine component calls all portlets via the Portlet API.

 
Figure 1: Portlet Container Overview
 
Portlet Driver

The Portlet Driver is a simple environment  to develop and test a portlet since there is no SPI to run the Portlet Container. The Portlet Driver retrieves the portlet markup fragments by delegating portlet execution to the Portlet Container via the container interface. It also provides the implementation for the PreferenceManager, CacheManager, PortalDataContext, and PortletEventDataContext interfaces defined by the Portlet Container.

Container Interface

The container interface defines the rules of interaction between the Portlet Driver and the Portlet Container.

Portlet Container

The Portlet Container implements the container interface. It is responsible for creating the execution environment for the portlets. However as mentioned above, the Portlet Container component will only do the work of caching content and assembling preferences and portal information. Once it collects the information, it will delegate the request to the portlet application engine for further processing via the Request Dispatcher mechanism. Following is a list of interfaces defined by the Portlet Container component.

 

Preference Manager


The preference manager is responsible for gathering preference information from the driver.

 

Cache Manager


The cache manager is responsible for caching view content in the normal state.

 

Portal Data Context


The portal data context is responsible for gathering information such as title of the portlet window, locale, user information, and content type from the driver.

 

Portlet Event Data Context


The portlet event data context is responsible for gathering the data related to the Portlet Events. The information includes the list of portlets that participate in eventing and also the list of events for the portlet.

Portlet Application Engine

The portlet application engine is the component that creates an execution environment for the portlets. It is composed of the portlet application engine servlet, the lifecycle manager, and the request response factory. These pieces create an environment where portlets are executed.

 

Portlet Application Engine Servlet


The portlet application engine servlet is the entry point into the portlet application engine. It receives requests for portlet processing from the portlet container via the Request Dispatcher. Upon receiving the request, it asks the lifecycle manager for an instance of the portlet and asks the request response factory to manufacture request and response, and finally it executes the portlet. Once the execution is complete, it returns the results back to the portlet container.

 

Lifecycle Manager


Lifecycle manager handles the creation, initialization, and destruction of portlets.

 

Request Response Factory


The request response factory is responsible for creating ActionRequest, ActionResponse, RenderRequest, RenderResponse, EventRequest, and EventResponse objects. In order to optimize, it may maintain a pool of reusable request and response objects.

Inter Portlet Communication

The Portlet Container supports eventing between portlets. Events may be passed between portlets that are in the same or different web applications. It uses event generation and notification to convey the information/data among portlets. Check docs for more details on Inter Portlet Communication.

Portlet Deployment

When a portlet web application is deployed, the Portlet Deployment performs three tasks:

  1. Makes an entry in the portlet registry with the information of all the portlets in the war file.
  2. Updates the portlet application war file by injecting servlet artifacts.
  3. Passes the modified war file to the application server deployment, which deploys it into the application server's system.


Installing the Portlet Container

The Portlet Container is bundled in Java Application Platform SDK Update 2. During the installation of the Java Application Platform SDK Update 2 software, select Portlet Container. After the installation is complete, simply start the Application Server and access the Portlet Container.

http://host_address:port/portletdriver/dt
 

It has two tabs, Portlets and Admin. The Portlets tab shows the portlet. In the Admin tab, one can deploy or undeploy the portlet application.

How to Deploy Portlets

On the Admin tab (under Deploy Portlet), enter the path name of the portlet and select deploy. The portlet will be deployed, and a portlet window with a thick width will be created.

Click on the Portlets tab to see the portlet content in the portlet window. The Portlet Window provides window decorations that support Portlet modes, VIEW, EDIT, and HELP and Window States, MAXIMIZE and MINIMIZE.

How to Undeploy Portlets

On the Admin tab (under Undeploy Portlet), select a portlet to undeploy (you can select multiple). After a successful undeployment, all the portlet windows associated with the portlet will be removed, and the portlet web application will be undeployed from the application server.

Creating Multiple Portlet Windows

Multiple portlet windows can be created based on the same portlet. On the Admin tab (under Create Portlet Window), select a base portlet, and enter the name of the portlet window and the title for the portlet window. The portlet window created will have a thin width. Click on the Portlets tab to see the portlet content in the portlet window.

Authentication

FORM-based authentication is used to authenticate the user. The default user supported is the AppServer admin user.

Portlet Preferences

Portlet Preferences are stored per user and per portlet window.

Conclusion

This article has described the Portlet Container 1.0 Beta software that ships with the Java Application Platform SDK Update 2, including the deployment and undeployment of portlets using the Portlet Container.

References


This article describes the Portlet Container 1.0 Beta software that ships with the Java Application Platform SDK Update 2, including the deployment and undeployment of portlets using the Portlet Container.

Note: Also see the Portlet Container 1.0 Beta Release Notes and Installation Instructions for Java Application Platform SDK Update 2, and an associated screencast.

 

Contents
 


 
Overview

The Java Portlet Specification ( JSR 168) is a standard for developing portal components with the Java programming language. The Portlet Container 1.0 Beta software that is part of Java Application Platform SDK Update 2 not only implements the Java Portlet Specification, but also provides a portlet driver, a lightweight portlet rendering environment. This driver simulates some capabilities of a typical portal product (like the Sun Java System Portal Server). This Portlet Container 1.0 Beta software also provides an extension to the standard Java Portlet allowing Inter Portlet Communication, a Portlet Specification 2.0 feature ( JSR 286).

In the future, the Portlet Container will provide Portlet 2.0 implementation when available.

This article provides an introduction to the Portlet Container in Java Application Platform SDK Update 2. First, you get an overview of the basic architecture (Note: This architecture may change in future updates of Portlet Container), and then you see how to deploy a portlet.

Figure 1 depicts the basic architecture. The Portlet Driver processes the client request, retrieves the portlets to be displayed, and then calls the portlet container to retrieve each portlet's content. The Portlet Driver accesses the Portlet Container with the Container API. The Portlet Container is composed of two major components: a portlet container component and a portlet application engine component. The portlet container component is only responsible for gathering preference and data from the portal and handling caching. The remainder of the work of providing an execution environment is delegated to the portlet application engine component. Finally, the portlet application engine component calls all portlets via the Portlet API.

 
Figure 1: Portlet Container Overview
 
Portlet Driver

The Portlet Driver is a simple environment  to develop and test a portlet since there is no SPI to run the Portlet Container. The Portlet Driver retrieves the portlet markup fragments by delegating portlet execution to the Portlet Container via the container interface. It also provides the implementation for the PreferenceManager, CacheManager, PortalDataContext, and PortletEventDataContext interfaces defined by the Portlet Container.

Container Interface

The container interface defines the rules of interaction between the Portlet Driver and the Portlet Container.

Portlet Container

The Portlet Container implements the container interface. It is responsible for creating the execution environment for the portlets. However as mentioned above, the Portlet Container component will only do the work of caching content and assembling preferences and portal information. Once it collects the information, it will delegate the request to the portlet application engine for further processing via the Request Dispatcher mechanism. Following is a list of interfaces defined by the Portlet Container component.

 

Preference Manager


The preference manager is responsible for gathering preference information from the driver.

 

Cache Manager


The cache manager is responsible for caching view content in the normal state.

 

Portal Data Context


The portal data context is responsible for gathering information such as title of the portlet window, locale, user information, and content type from the driver.

 

Portlet Event Data Context


The portlet event data context is responsible for gathering the data related to the Portlet Events. The information includes the list of portlets that participate in eventing and also the list of events for the portlet.

Portlet Application Engine

The portlet application engine is the component that creates an execution environment for the portlets. It is composed of the portlet application engine servlet, the lifecycle manager, and the request response factory. These pieces create an environment where portlets are executed.

 

Portlet Application Engine Servlet


The portlet application engine servlet is the entry point into the portlet application engine. It receives requests for portlet processing from the portlet container via the Request Dispatcher. Upon receiving the request, it asks the lifecycle manager for an instance of the portlet and asks the request response factory to manufacture request and response, and finally it executes the portlet. Once the execution is complete, it returns the results back to the portlet container.

 

Lifecycle Manager


Lifecycle manager handles the creation, initialization, and destruction of portlets.

 

Request Response Factory


The request response factory is responsible for creating ActionRequest, ActionResponse, RenderRequest, RenderResponse, EventRequest, and EventResponse objects. In order to optimize, it may maintain a pool of reusable request and response objects.

Inter Portlet Communication

The Portlet Container supports eventing between portlets. Events may be passed between portlets that are in the same or different web applications. It uses event generation and notification to convey the information/data among portlets. Check docs for more details on Inter Portlet Communication.

Portlet Deployment

When a portlet web application is deployed, the Portlet Deployment performs three tasks:

  1. Makes an entry in the portlet registry with the information of all the portlets in the war file.
  2. Updates the portlet application war file by injecting servlet artifacts.
  3. Passes the modified war file to the application server deployment, which deploys it into the application server's system.


Installing the Portlet Container

The Portlet Container is bundled in Java Application Platform SDK Update 2. During the installation of the Java Application Platform SDK Update 2 software, select Portlet Container. After the installation is complete, simply start the Application Server and access the Portlet Container.

http://host_address:port/portletdriver/dt
 

It has two tabs, Portlets and Admin. The Portlets tab shows the portlet. In the Admin tab, one can deploy or undeploy the portlet application.

How to Deploy Portlets

On the Admin tab (under Deploy Portlet), enter the path name of the portlet and select deploy. The portlet will be deployed, and a portlet window with a thick width will be created.

Click on the Portlets tab to see the portlet content in the portlet window. The Portlet Window provides window decorations that support Portlet modes, VIEW, EDIT, and HELP and Window States, MAXIMIZE and MINIMIZE.

How to Undeploy Portlets

On the Admin tab (under Undeploy Portlet), select a portlet to undeploy (you can select multiple). After a successful undeployment, all the portlet windows associated with the portlet will be removed, and the portlet web application will be undeployed from the application server.

Creating Multiple Portlet Windows

Multiple portlet windows can be created based on the same portlet. On the Admin tab (under Create Portlet Window), select a base portlet, and enter the name of the portlet window and the title for the portlet window. The portlet window created will have a thin width. Click on the Portlets tab to see the portlet content in the portlet window.

Authentication

FORM-based authentication is used to authenticate the user. The default user supported is the AppServer admin user.

Portlet Preferences

Portlet Preferences are stored per user and per portlet window.

Conclusion

This article has described the Portlet Container 1.0 Beta software that ships with the Java Application Platform SDK Update 2, including the deployment and undeployment of portlets using the Portlet Container.

References


Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.