SAS 9.1.3 Integration Technologies » SAS Web Infrastructure Kit: Developer's Guide


Developing Custom Portlets
Development Steps
Creating a Deployment Descriptor
Creating Display Resources Files
Developing the Presentation JSP Page
Creating Action Classes
Implementing Portlet Help
Creating a PAR File
Use Cases
Simple Display Portlet
Localized Portlet
Portlet Template (Editable Portlet)
Remote Portlet
Tips and Best Practices
Using the Portlet API
Sample Portlets
Localized Display Portlet (Welcome)
Interactive Form Portlet (FormExample)
Portlet Template, or Editable Portlet (DisplayURL)
Web Application (HelloUserWikExample)
Remote Portlet (HelloUserRemote
Portlet
Developing Custom Portlets

Using the Portlet API

The Portlet API provides access to classes that provide the portal Web application's navigation and request processing functions. For detailed information about the API, see the class documentation.

The following classes are of particular usefulness in creating custom portlets:

com.sas.portal.portlet.DefaultPortletAction

You can extend this class in order to create your own portlet actions. For more information, see Creating a Portlet Action Class.

com.sas.portal.portlet.ErrorHandlerInterface

You can use this interface to handle errors that your portlet encounters. For more information, see Error Handling Actions.

com.sas.portal.portlet.HTMLPortletAction

You can extend this class in order to create your own portlet actions. For more information, see Creating a Portlet Action Class. Possible uses include the following:

com.sas.portal.portlet.PortletContext

You can use this interface to obtain the name of the person who is logged on to the portal Web application. Use the getSessionContext() method to retrieve the session context, use the getUserContext() method to retrieve the user context from the session context, and then use the getPerson() method to obtain the user's name.

com.sas.portal.portlet.NavigationUtil

You can use this class to do the following:

  • create URLs for buttons on your JSP pages (for example, OK and Cancel buttons). For an example of this use, see Creating a Portlet Template.

  • obtain a portlet's resource bundles in order to create a localization context for your portlet's JSP page. For an example of this use, see Creating a Localized Portlet.

com.sas.portal.portlet.PortletActionInterface

You can use this interface to develop an action class for your portlet. For more information, see Creating a Portlet Action, and Step 4: Create the Action Class in the Sample Localized Display Portlet (Welcome Portlet) .

com.sas.portal.portlet.PortletInitializerInterface

You can use this interface to develop an initializer class, which runs before your portlet is displayed for the first time on a portal page. Possible uses include

  • reading initial parameters that are specified in your portlet's deployment descriptor file (portlet.xml)

  • connecting to an external resource such as a database

For more information, see Creating an Initializer Action.

com.sas.portal.portlet.PostProcessorInterface

You can use this interface to develop a postprocessor class that runs when your portlet is no longer on display. Possible uses include the following:

  • freeing resources that were used in the portlet initializer.

  • removing HttpSession attributes that were set in the portlet initializer or portlet action. This is especially important to consider since multiple copies of your portlet could exist on other portal pages or even on the same page.

For more information, see Creating a Postprocessor Action.

For detailed information, see the class documentation.