Package, deploy and compile cooperative portlets
Create the deployment descriptors
WAR files must have...
Standard portlets web.xml must contain servlet information, not portlet information. If the standard portlet does not contain servlets, web.xml must still be present, though the content of the file will be empty. IBM portlets web.xml must contain both servlet and portlet information. Modify web.xml to refer to the property broker classes. For IBM only, the servlet class entry should specify...
com.ibm.wps.pb.wrapper.PortletWrapper
To specify the location of the WSDL file associated with each portlet, modify portlet.xml, and set the configuration parameter, c2a-action-descriptor.
The parameter, c2a-nls-file, specifies the base name of an NLS resource file containing translated text corresponding to the captions and descriptions of actions and properties.
This file may be packaged in the same WAR file, so a relative path may be used.
Standard portlet examples
Sample web.xml file for standard portlet with empty content:...
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Shipping Portlets - Standard Version</display-name> </web-app>Sample standard portlet.xml file...
<?xml version="1.0"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> <portlet> <description xml:lang="en"> Displays details for a particular order </description> <portlet-name>StandardOrderDetail</portlet-name> <display-name xml:lang="en">Standard Order Detail</display-name> <portlet-class> com.ibm.wps.portlets.shipping.OrderDetailPortlet </portlet-class> <expiration-cache>3600</expiration-cache> <supports> <mime-type>text/html</mime-type> </supports> <supported-locale>en</supported-locale> <resource-bundle>nls.StandardOrderDetail</resource-bundle> <portlet-preferences> <preference> <name> com.ibm.portal.propertybroker.wsdllocation </name> <value>/wsdl/OrderDetail.wsdl</value> </preference> <preference> <name>com.ibm.portal.context.enable</name> <value>true</value> </preference> </portlet-preferences> </portlet> ... </portlet-app>For standard portlets, a special <preference> entry must be used to specify the application portlet class.
<portlet-preferences> <preference> <name>com.ibm.portal.propertybroker.wsdllocation</name> <value>/wsdl/OrderDetail.wsdl</value> </preference> </portlet-preferences>
IBM portlet examples
Sample web.xml file for IBM portlet...
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> <web-app id="ShippingPortletsC2ANew"> <display-name>Shipping Portlets</display-name> <servlet id="OrderDetailC2A"> <servlet-name>Order Detail</servlet-name> <servlet-class> com.ibm.wps.pb.wrapper.PortletWrapper </servlet-class> <init-param> <param-name> c2a-application-portlet-class </param-name> <param-value> com.ibm.wps.portlets.shipping.OrderDetailPortlet </param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet id="OrderMonthC2A"> <servlet-name>Orders</servlet-name> <servlet-class> com.ibm.wps.pb.wrapper.PortletWrapper </servlet-class> <init-param> <param-name>c2a-application-portlet-class</param-name> <param-value> com.ibm.wps.portlets.shipping.OrderMonthPortlet </param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> ... <servlet-mapping id="OrderDetailMapping"> <servlet-name>Order Detail</servlet-name> <url-pattern>/OrderDetail/*</url-pattern> </servlet-mapping> <servlet-mapping id="OrderMonthMapping"> <servlet-name>Orders</servlet-name> <url-pattern>/Orders/*</url-pattern> </servlet-mapping> ... </web-app>
- The portlet wrapper must be specified.
For example, <servlet-class>com.ibm.wps.pb.wrapper.PortletWrapper</servlet-class>.
- The <init-param> entry must be used to specify the application portlet class.
<init-param> <param-name>c2a-application-portlet-class</param-name> <param-value> com.ibm.wps.portlets.shipping.OrderDetailPortlet </param-value> </init-param>
Sample IBM portlet.xml file...
<?xml version="1.0"?> <!DOCTYPE portlet-app-def PUBLIC "-//IBM//DTD Portlet Application 1.1//EN" "portlet_1.1.dtd"> <portlet-app-def> <portlet-app uid="com.ibm.wps.portlets.shippingc2anew"> <portlet-app-name>Shipping Application</portlet-app-name> <portlet id="OrderDetailC2A" href="WEB-INF/web.xml#OrderDetailC2A"> <portlet-name>Order Detail</portlet-name> <cache> <expires>3600</expires> <shared>YES</shared> </cache> <allows> <maximized/> <minimized/> </allows> <supports> <markup name="html"> <view output="fragment"/> </markup> </supports> </portlet> ... <concrete-portlet-app uid="concrete.com.ibm.wps.portlets.shippingc2anew"> <portlet-app-name>Shipping Application</portlet-app-name> <concrete-portlet href="#OrderDetailC2A"> <portlet-name>Order Detail</portlet-name> <default-locale>en</default-locale> <language locale="en"> <title>Order Detail</title> <title-short>OD</title-short> <description> Displays details for a particular order </description> <keywords> Property Broker, Click-to-Action, C2A, Cooperative Portlets </keywords> </language> <config-param> <param-name>c2a-action-descriptor</param-name> <param-value>/wsdl/OrderDetail.wsdl</param-value> </config-param> <config-param> <param-name>c2a-nls-file</param-name> <param-value>nls.shipping</param-value> </config-param> </concrete-portlet> ... </concrete-portlet-app> </portlet-app-def>
In order to support translation, portlets must provide resource bundles in the appropriate location in the WAR file. For IBM portlets, the resource file name to be used can be specified in the <config-param> parameter.
WAR file
Once the code and deployment changes have been made for using the property broker, additional libraries and files must be packaged along with the application. After you package the WAR file, it is ready to be installed. Use the following table to package the files in the correct location.
Portlet type IBM portlet only Standard and IBM File name pbportlet.jar The version of pbportlet.jar must match the version of the product being used.
WSDL file Path /WEB-INF/lib relative to the root of the WAR file or an absolute URL Original location PortalServer_root/base/wp.propertybroker.legacy.impl/pb/lib
Additional considerations for compiling
For your own development environment, add the wp.propertybroker.standard.api.jar (for standard portlets) or wp.propertybroker.legacy.api.jar (for IBM portlets) file to your class path. These JAR files can be found in the PortalServer_root/base/wp.propertybroker.standard.api/shared/app and the PortalServer_root/base/wp.propertybroker.legacy.api/shared/app directories, respectively. For other JAR file requirements, see Creating a simple portlet.
Parent topic:
Cooperative portlets
Related concepts
Cooperative portlets overview
Cooperative portlet programming model
Related reference
WSDL reference for cooperative portlets