|
Guide to Working with Portlets in uPortal 2.3ContentsIntroductionServlet Container Issues Sample Portlets Deploying Portlets Publishing Portlets Portlet Caching User Information Custom Portlet Modes and Window States Future of Portlets in uPortal IntroductionuPortal is committed to supporting open standards including the Java Portlet Specification, initially known as JSR 168. Portlets are designed to be the basic building block of a Portal. The uPortal analog to a Portlet has thus far been the Channel which is based on theorg.jasig.portal.IChannel
java
interface. To provide a runtime environment for Portlets, uPortal
has chosen to use a Portlet Container from the Apache Jakarta project
called Pluto.
Pluto is the reference implementation of the Java Portlet
Specification. uPortal 2.3 embeds the Pluto container and
includes a Portlet adapter that makes it possible to install
and render Portlets along with its native Channels. The End-User
of uPortal can not tell the difference between a Portlet and a Channel.
Pluto, when downloaded separately from Apache, is distributed with several components:
Servlet Container IssuesuPortal, with its implementation of Pluto, requires that the web application context representing the deployed portal web application be set as "cross context" because Pluto dispatches the Portlet request objects to the individual Portlet applications which run in their own web application context. Each servlet container should provide a means to enable this "cross context" setting. It can be accomplished in the Tomcat servlet container in the following ways:
Sample PortletsuPortal 2.3 comes with 3 sample Portlets that are preinstalled:
Note: The Google Portlet will not be fully functional until you configure a license key in the <init-param> element
of Google Portlet's portlet.xml file. To obtain a
license key, visit Google Web
APIs and follow instructions to set up an account. Once you
have the license key, unzip the GooglePortlet.war file,
modify
the WEB-INF/portlet.xml file, and then zip it all up
again.
Deploying PortletsThe sample portlets mentioned above were all deployed as part of uPortal'sinitportal ant target. The ant target
subtask of initportal that performs the deployment of
Portlet Applications is deployPortletApp . The deployPortletApp
target runs the portlet deployer tool, org.jasig.portal.container.deploy.Deployer .
This tool takes a Portlet WAR file, rewrites the web.xml
file (a requirement of the Pluto Portlet Container), and deploys the
results to the servlet container. You can deploy multiple
portlets at once by placing them in uPortal's lib/portlets
directory and specifying all as the porletApp. For
example: ant deployPortletApp -DportletApp=all You can also deploy one Portlet application at a time by specifying the location of the Portlet application WAR file:
Publishing PortletsuPortal will build a Portlet Registry based on all the Portlets that are deployed into the servlet container. It does this by examining all the installed web applications, looking for the ones that contain aportlet.xml file, and parsing that portlet.xml
file to find out what Portlet Application Definitions and Portlet
Defiinitions are available.To publish a Portlet in uPortal, you need to know the Portlet Definition ID and any necessary parameters. The Portlet Definition ID is in the form of [portlet-context-name].[portlet-name] .
For example, for the Pluto Test Suite Portlet, the application was
bundled as testsuite.war and the Portlet name from portal.xml
was TestPortlet1 . Therefore the Portlet Definition
ID for this Portlet would be testsuite.TestPortlet1 .Once you know the Portlet Definition ID, you can publish the Portlet either via the Channel Manager publishing GUI or by creating a channel definition XML file and placing it in uPortal's properties/chanpub
directory. That directory already contains sample channel
definition XML files for the 3 included sample Portlets that are
described above. If you choose to publish the Portlet using the
GUI, select the Portlet channel type and follow instructions to enter
the required parameters. In both cases, you are actually
publishing a Portlet adapter which knows how to find and
render the appropriate Portlet based on the Portlet Definition ID.Portlet CachingIn order to make the Portlet adapter as efficient as possible, a caching strategy was implemented that is beyond the scope of the Portlet's control. It works as follows: uPortal will cache the contents of a Portlet screen until one of the following occurs:
User InformationAs of uPortal 2.3.2, you will be able to access a user attribute with the following code:
The Portlet Specification says that you should be able to map user
attribute names declared in the portlet.xml file at
deployment
time.
In uPortal 2.3, this feature will not be available. Instead, you
will
have to edit uPortal's PersonDirs.xml file, adding
aliases for any of the user attribute names declared in the portlet.xml
file that don't already exist in PersonDirs.xml .
Only the attributes defined in portlet.xml will be
accessible to your
portlet. For example, if your portlet.xml file
contains...<user-attribute> ...then your PersonDirs.xml will need to
contain something like...<attribute>
<name>FIRST_NAME</name> <alias> user.name.given </alias> Full support of deployment-time mapping will be available in uPortal 3.0. Custom Portlet Modes and Window StatesuPortal 2.3 supports the following Portlet modes:
uPortal 2.3 supports the following Portlet window states:
Future of Portlets in uPortaluPortal 3.0 will continue to support Portlets using the Pluto Portlet Container. The Portlet will eventually replace the Channel as the primary portal module. This means that terminology within uPortal will change to reflect the use of Portlets rather than Channels. Also the rendering architecture of uPortal will be simplified to handle the Portlet natively, rather than through an adapter. The Channel, of course, will still be supported though a Channel adapter. uPortal 3.0 is still in its early design stages. More will be added to this section as the design matures. |
JA-SIG Home About uPortal FAQ Download Documentation Getting Involved Code Repository Reporting Bugs License |