Portals Bridges

## Overview

Portals Bridges provides support for JSR-168 compliant Portlet development using common web frameworks like Struts, JSF, PHP, Perl, Velocity and Groovy.

### JavaServer Faces

JavaServer Faces (JSF) applications can be run within an Portlet environment with little or no changes using the JSF bridge which provides a JSFPortlet ready to be deployed. Similar functionality is also available from the Apache MyFaces PortletBridge. This bridge is the reference implementation for JSR 301: Portlet Bridge for JavaServer Faces.

### Struts and PHP

Pure servlet based frameworks like Struts or PHP 4 (with the Java binding) are very difficult to use in a Portlet environment because they only support and understand a single request event.

For a Portlet, the request processing has to be handled in two separated action and render events. Furthermore, the Portlet Specification doesn't allow servlet access during the action request event.

A distinctive feature of the Portals Bridges is that it removes these barriers and thereby allows the mapping of an action request event to the underlying servlet handler implementation (e.g. a StrutsAction).

All that is needed is an implementation of the generic ServletContextProvider interface, provided with The Portals Bridges Common library, for a specific Portal.

The Portals Struts Bridge furthermore provides a truly transparent mapping of the two request events onto the underlying Struts Action mappings and enables an existing Struts Application to be run within a Portlet context with very little changes.

The following table contains a list of Portals already known to support this solution:

Portal | License | Support | Comment
--- | --- | --- | ---
Jetspeed 2 Enterprise Portal | Apache | Native | All the Apache Portals Bridges are developed using Jetspeed 2
Jetspeed 1 Enterprise Portal | Apache | Native (Fusion) | The 1.6 Fusion release provides JSR-168 support using Jetspeed 2 as embedded portlet container
JBoss Portal | LGPL | Native | The Struts Bridge is provided with JBoss Portal 2.0
GridSphere Portal | GridSphere Open License | Native | The Struts Bridge is provided with Gridsphere Portal 2.1
Stringbeans Portal | GPL, Commercial | Native | The Struts Bridge is provided with Stringbeans Portal 2.5
Vignette Application Portal | Commercial | Custom | The Struts Bridge is successfully used with VAP 7.x
Apache Cocoon Portal | Apache | Native | The Struts Bridge is successfully used with the latest Cocoon Portal engine.

### Velocity

Although JavaServer Pages (JSP) are very much promoted for Portlet View rendering, other technologies can be used just as easily. The Portals Velocity Bridge provides several ready to use Velocity based Portlets, together with a library of useful scripts.

### Groovy

The Groovy Portlet Bridge allows using groovy scripting for rapid portlet development. A groovy script portlet can be implemented like Java-based portlets, and so developers can use any techniques used in Java. For example, a groovy script portlet can extend org.apache.portals.bridges.common.GenericServletPortlet to simplify implementation. Therefore, GroovyPortlet is very simple, but it will be very useful for developers.

### Perl

Perl based web applications can be accessed as a Portlet using the Portals Perl Bridge.

### Common Utilities and Interfaces

The Portals Bridges Common library provides, besides the already mentioned ServletContextProvider interface, several additional utilities like a GenericServletPortlet which you can use for simple JSP based Portlets (or any invokable view Render technology). Or use it as base class for your own Bridge.

Other useful utilities included are a PreferenceHelper and a simple PortletMessaging component.

### PortletFilter

The Portlet Filter provides a FilterPortlet which enables you to add processes to run before and after accessing the target portlet. The feature provided by FilterPortlet is like a Servlet Filter. (Portlet Filter may be included in the future Portlet Spec, but currently it's not included yet.)

### Examples

Several examples using the bridges are available:

- The JSF Portlet Demo application using the JSF Portlet Bridge
- The iBATIS JPetstore Demo Portlet application using the Struts Portlet Bridge
- The PHP Portlet application
- The Perl Portlet application
- The Andromda Struts demo portlet application created using the Andromda BPM4Struts cartridge

Furhermore, Jetspeed 2 makes full use of bridges. For example have a look at:

- The Jetspeed-2 Administration using the Velocity Bridge