In this three-part series, the articles describe new features available in the Java Portlet Specification (JSR ) and extensions supported by OpenPortal. The Java platform provides an standard referred to as JSR that standarizes how portlets interact with portlet containers and ensures compatibility across. In , Java Portlet Specification (JSR) first defined portal and For a detailed description of these features, see the tutorial OSGi and Modularity. Note .
|Published (Last):||12 August 2016|
|PDF File Size:||2.93 Mb|
|ePub File Size:||9.53 Mb|
|Price:||Free* [*Free Regsitration Required]|
View the basic steps for creating a simple portlet, that include writing the portlet code, compiling java source, creating the JAR file, writing the portlet descriptors, setting up the WAR file directory structure, and packaging and deploying portlets.
Before you begin developing portlets, set up an environment that makes the tasks of writing, compiling, and testing portlets easier. You can set up the run time environment for debugging porflet on the local development machine or on a remote server.
Refer to the documentation for Rational Application Developer for complete setup instructions. A particular class loader can reference other classes as long as the other classes can be loaded by the same class loader jrs any of its ancestors, but not its children.
The graphic illustrates where WebSphere Portal Express and portlet applications fit into the classloading hierarchy.
Creating a simple portlet
In the following graphic runtime classpath patches RCP is located at the top of the hierarchy. Runtime classpath RP branches from runtime classpath patches. Runtime extensions RE branches from runtime classpath, and application extensions AEX branch from runtime extensions. Application class loaders AC1application class loaders AC2and application class loaders AC3 are portlet applications that branch from application extensions.
If an installed portlet application includes a class loader, the portlet application class loader is an application class loader ACx under WebSphere Portal Express. If you suspect a classloading problem, ensure that the required classes are in the appropriate classpath according to the classloading hierarchy.
Next, the portlet must be packaged in the JAR file format. Omit this tag if the portlet does not use this feature. If you are familiar with the web.
There are number of differences between the elements in this example and the corresponding Figure 8. Before you package your portlet, the class files and resources must be arranged in the WAR file directory structure described here. A portlet application tutoriql as a structured hierarchy of directories.
The portlet information directory is not part of the public document tree of the application. To deploy a portlet and turorial it on the server, it must be packaged in the form of a Web application ARchive or WAR file. The WAR file format contains the Java classes and resources that make up one or more portlets in a portlet application.
The resources can be images, JSP files, Writing the portlet descriptorsand property files containing translated message text.
Java Portlet Specification
Packaging portlet classes, resources, portoet descriptive information in a single file makes distribution and deployment of portlets easier. WebSphere Portal Express includes an administrative portlet for installing, uninstalling, and updating portlets. Portlets contained in WAR files have the advantage of being dynamically downloaded and installed. The portal administrator can download a WAR file from the Internet and then use the portal administration interface to install the portlet to WebSphere Portal Express.
After installation, the portlet is ready for use and does not require the server to be restarted. To facilitate deployment of portlet applications and complex portlets, you can provide a portlet configuration file that can be invoked by the XML configuration interface XMLAccess.
The XML configuration interface allows the portlet developer to specify places, pages, themes, skins, supported markups and clients, and other settings for a portlet application.
This is especially useful for portlets that use messaging because these portlets have to be placed on the same page.
For more information, see The XML configuration interface. If this value has not been specified, specify the WAR file name of the portlet application in its place.
For portlet tktorial, the WAR file name must be the original name of the WAR file used to 28 the portlet application. That is, the WAR file name can be changed, but the uid must indicate the original uid used during portlet installation.
Rational Application Developer provides wizards to help you build, test, and deploy portlets using all of the APIs and related classes and interfaces available in the portlet run time environment. You can also build portlets using your own development environment and tools. If you are not using tutoria, to develop portlets, the following topics describe the mechanics ttorial building a simple portlet. The Hello World portlet provides an introduction to writing your first portlet.
The portlet is provided along with the source in the IBM Portlet Samples package, which is available from the portlet catalog by searching tutoria navcode 1WPZ. See Sample portlets for more information. Hello World provides the fewest methods required for a portlet.
It uses the portlet response object to write simple output directly to the portal page. Compile your Java source files. To do this, jr as follows: Standard portlets Table 2. Then, compile the portlet using the fully tytorial path to the Java portlet source.
JSR Portlet- Hello World | Portal HUB
The following shows the minimum elements required yutorial the standard portlet deployment descriptor. The application server searches for security policy files in tutoril location of the enterprise application archive rather than the Web application archive. Therefore, the portal server copies was. Because Windows limits the maximum path length to characters, the name of the WAR file must be less than 25 characters. On a portal server running on Windows, installing a WAR file with a name that is more than 25 characters will result in yutorial error.
You can also run the build-war-file or build-ear-file tasks to build the. When constructing XMLAccess scripts for use in installing standard portlets, use the following values: For example, a portlet application might use a portlet descriptor as follows: GenericPortlet which also can throw a PortletException. Use this file if you use services from the Public API javadoc package.
Use this file if you use services from the Public SPI javadoc package.