Содержащиеся вНайти другие документыРесурсы поддержки | Загрузить это руководство в формате PDF (1107 КБ)
Chapter 13 Converting Providers to PortletsThis chapter contains the following sections: Introduction to Converting Providers to PortletsThere are numerous differences in the way portlets and providers generate content for the desktop. In order to perform a successful conversion, the user must first understand the portlet request handling sequence. The ability to access user preferences and LDAP attributes from the portlet is vital to generating the correct content. Converting JavaServer PagesTM (JSPs) and tag libraries is the next step. JSPProvider-based JSPs and taglibraries need extensive reworking to function within the portlet framework. There is no need for a tag to wrap all the content; so all references to <dt:obtainChannel channel="$JSPProvider"> can be removed. All taglibraries specific to the desktop (desktop.tld, desktopProviderContext.tld) should be removed from the JSP and replaced with portlet taglibraries. Unfortunately, very few of the desktop taglibraries have portlet counterparts. The generic portlet taglibrary (portlet.tld in http://java.sun.com/portlet) has a number of useful tags. There are no handles to the portlet object available to the JSP, unlike providers. Any objects that need to be shared between external JSP and/or servlets and the portlet should be stored in the session at the application scope. Note that there is no functionality present in the GenericPortlet abstract class to convert a template-based provider, other than the ability to use HTML files for each portlet mode. Packaging, deploying and testing the new portlet are the last steps in this process. Portlets are deployed in a custom web-app. This means all JAR files, JSPs, templates, servlets, and properties files that the portlet uses must either be included or defined in the portlet deployment descriptor file (portlet.xml) or the web application deployment descriptor file (web.xml). A WAR file is created that contains all the files and information needed to deploy the web-app. The psadmin deploy-portlet command can be used to deploy the WAR file to the web container. Mapping ProviderAdapter to GenericPortletThe following table can be used as a guideline for comparing the Provider API to the Portlet API, when developing or trying to convert providers to portlets. Table 13–1 Mapping ProviderAdapter to GenericPortlet
The Javadocs for the Provider API can be accessed at the following URL:
For further reading on the Portlet API, see http://portals.apache.org/pluto/multiproject/portlet-api/apidocs/index.html. Sample Code Fragments for Provider to Portlet ConversionThis section includes some sample code fragments for Provider to Portlet conversion. Provider to Portlet Mapping
Dispatching to a JSP
Help DocumentationHelp documentation for portlets follows a different scheme than in the providers. The help file name is stored as a preference and content is generated from that file the same way as any other content type.
Title Mapping
editType PropertyFor a provider, the editType display profile property can be specified to determine whether the provider implementation will draw the complete edit page or a subset of it. For portlets, the editType is always EDIT_COMPLETE and the complete page including the form, the Finish, and the Cancel buttons have to be generated by the portlet. Only the banner and footer are drawn by the PortletEdit.jsp in PortalServer-DataDir/portals/portal-ID/desktop/default directory. PortletPreferences MappingThe ProfileProviderAdapter.getStringProperty(key) maps to PortletPreferences.getValue(key, default) The ProfileProviderAdapter.getListProperty(key) maps to PortletPreferences.getValues(key, default[]) |
||||||||||||||||||||||||||||||||||||||||||