Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Build portals with Jetspeed

Use Apache Jetspeed to build portals out of Web services

  • Print
  • Feedback
Developers are facing a new application integration challenge: building existing content, server-side Java applications, and Simple Object Access Protocol (SOAP)-based Web services into a coherent frontend application for their users. Most of you are familiar with consumer-oriented Websites -- such as Lycos, AltaVista, and Yahoo! -- that aggregate content and services into portals. Company intranets have used portals for years to make internal systems available to employees. Those intranets tend to be either expensive proprietary solutions or internally supported homegrown portals. If you're looking for an open source way to develop your own portal solution, look no further than the Jetspeed project from the Apache Software Foundation. For Java developers, Jetspeed offers a Portal API for developing small Java applications, known as portlets, that run inside the portal. The IBM WebSphere Portal Server also supports that Portlet API.

What does Jetspeed do?

Jetspeed lets you focus on building connections to outside resources, such as Web services, databases, and content feeds. It features built-in services for user interface customization, caching, persistence, and user authentication. As a portal developer, you don't have to build any of those services yourself; instead, you can concentrate on retrieving external data and displaying it. Jetspeed doesn't place any restrictions on what resources portlets may access.

Each user has individual settings for displaying portlets on his or her portal, for both wireless and Web access. Some portlets may only work on the Web, while some may also work on mobile devices; users can have different portlets for each. User authentication is abstracted through interfaces, and you can implement the authenticate() method on the UserManager interface from Turbine (provided as part of Jetspeed) or you can replace the method with a pluggable authentication module. You could use that module as part of a single sign-on solution, in which your portal handles frontend authentication, or to access an existing database of user information.

To display content, portlets use the Element Construction Set (ECS) API, which generates markup elements from Java objects. ECS supports the Wireless Markup Language (WML) as well as HTML and XML, and is open source under the Apache license. It is available from the Jakarta Apache Project; however, the ECS jar file is bundled with Jetspeed, so no additional downloads are necessary. It may be easier to use a servlet-based template or Web publishing technology, such as JSPs, WebMacro, or Velocity, to generate content for your portlet. ECS can run a servlet and capture the output in an ECS element, which may then be used as the displayed content.

Without any Java programming, you can easily set up Jetspeed to get news headlines and content from other Websites. Jetspeed can use both the RSS (RDF Site Summary) and OCS (Open Content Syndication) formats. RSS is an XML format used for syndicating Web headlines. Websites publish RSS feeds to anyone on the Internet interested in retrieving them. The headlines link back to the publishing Website for the article's full content. The OCS format describes multiple-content channels, including RSS headlines. To configure new content channels for Jetspeed, add them to your WEB-INF/conf/jetspeed-config.jcfg file.

Jetspeed architecture



Jetspeed is built on top of Turbine, an open source application framework from the Jakarta Apache Project. Most Apache projects are either built on Turbine or integrated with it. Some of Jetspeed's concepts, such as screens and user information, are borrowed from Turbine.

Jetspeed can sit on a number of servlet runners and databases. We'll be using the Tomcat 3.2 servlet runner, also from the Jakarta Apache Project. Tomcat also acts as a Web server, so you won't need an additional HTTP server.

Jetspeed is bundled with Thomas Mueller's Hypersonic SQL database. Tables are already created and populated with user data in Hypersonic SQL. Hypersonic SQL runs in process to Jetspeed (and Tomcat), so no additional configuration is necessary. If you want to use a different database, such as Oracle, DB2, Sybase, MySQL, or Postgres, you must set up the database using the SQL scripts included with the Jetspeed source code. In addition, you must configure the TurbineResources.properties file that Jetspeed and Turbine use to point to the new database server.

I recommend that you use the Hypersonic SQL database. The most common complaint on the Jetspeed users mailing list is that configuring a new database, like MySQL, doesn't work. If you do run into problems with another database, first check the Jetspeed and Turbine mailing list archives for other developers' experiences with the software (see Resources). Jetspeed uses Turbine's database connection code. Of course, you can use any database from your portlet; Jetspeed just uses Hypersonic SQL internally.

Install Jetspeed

To install Jetspeed, follow these three steps:

  • Download and install Tomcat 3.2.
  • Download the Jetspeed binary distribution (currently 1.3a1) and place the war file in Tomcat's webapps directory.
  • Download Apache James if you don't already have an SMTP server running on your machine. Configure the mail.server property in Jetspeed's TurbineResources.properties, which resides in the webapps/jetspeed/WEB-INF/conf subdirectory under the directory where you installed Tomcat.


Detailed installation instructions are available on the Jetspeed Webpage; see Resources for a link.

Jetspeed is packaged as a war file, and can be dropped into Tomcat's webapps directory. You'll need to restart Tomcat if it's already running.

The testing URL for Jetspeed is http://localhost:8080/jetspeed/. If you change Tomcat's default port, replace 8080 with your new port number. You can log in using turbine as both your username and password, or just use the default configuration without logging in.

Develop new portlets

When you develop new portlets for Jetspeed, use the AbstractPortlet class as a base. This is in the org.apache.jetspeed.portal.portlets package. By extending AbstractPortlet, you can have a working portlet by implementing the getContent() method. The getContent() method also takes an implementation of the RunData interface from Turbine as a parameter. By accessing get or set methods from the RunData interface, you have access to the runtime information stored in Turbine, including cookies, locale, and user data. Most of this data is actually handled by Jetspeed itself, and isn't needed for portlet development.

  • Print
  • Feedback

Resources