What's New in RAD PTK

advertisement

Disclaimer

The information contained in this document is provided for educational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this document, it is provided

“as is” without warranty of any kind, expressed or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this document. Nothing contained in this document is intended to, nor shall have the effect of, creating any warranties or representations from IBM (or its suppliers or licensors), or altering the terms and conditions of any agreement or license governing the use of IBM products and/or software.

JSR 301 or JSR 289 JSF Bridge is open source software created by third parties and use of this bridge together with IBM Rational Application Developer is at the user's own risk. IBM shall not be responsible for any damages arising out of the use of JSR 301/ JSR 329 Open Bridge, and IBM has no obligation to, and shall not, support JSR

301/ JSR 329 Open Bridge.

JSR 301 portlet bridge support in Rational Application

Developer V7.5.x

This document describes the steps to consume Apache JSR 301 portlet bridge reference implementation in Rational Application Developer V7.5.x.

Prerequisites :

Download the following JSR 301 RI binaries from the Apache site http://myfaces.apache.org/portlet-bridge/1.0/downloads.html

:

• portlet-bridge-api-1.0.0-beta-2.jar

• portlet-bridge-impl-1.0.0-beta-2.jar

Server version: WP6.1.0.2(with a test fix PK92277) based on WAS7

WP6.1.0.3 based on WAS 7

NOTE: The same steps below can be followed and should work for consuming JSR 329 portlet bridge as well.

Steps to consume JSR 301 RI:

I) Follow the steps to create a JSF Portlet project:

1.

Click File->New->Portlet Project.

2.

Provide the project name as TestJSR301.

3.

Select WebSphere Portal Server V6.1 on WebSphere Application Server V7.0 as the target runtime environment.

NOTE: Click the “Show Advanced Settings” button and verify that the

“Dynamic Web Module” version is set to “2.5” and “Java Server Faces” version is set to “1.2”. If not change the versions manually.

4.

Select JSR 168 as the Portlet API and Faces as the Portlet Type.

5.

Click Finish. This will create a JSF Portlet Project.

II) Configure the project to use JSR 301 portlet bridge:

1.

Delete the IBM JSF portlet bridge jar file.

2.

Click WebContent->Web-Inf->lib folder of the project created, and delete the jsfportletbridge.jar file.

3.

Copy the following JSR 301 RI jars files to the lib folder of the project.

• portlet-bridge-api-1.0.0-beta-2.jar

• portlet-bridge-impl-1.0.0-beta-2.jar

4.

Open the portlet.xml in the project, modify the portlet class and the mode ID from

< portlet-class > com.ibm.faces.portlet.FacesPortlet

</ portlet-class >

< init-param >

< name > com.ibm.faces.portlet.page.view

</ name >

< value > /TestJSR301View.jsp

</ value >

</ init-param > to:

< portlet-class > javax.portlet.faces.GenericFacesPortlet

</ portletclass >

< init-param >

< name > javax.portlet.faces.defaultViewId.view

</ name >

< value > /TestJSR301View.jsp

</ value >

</ init-param >

5.

Open the faces-config.xml and delete the following IBM portlet bridge variable resolver entry:

< variableresolver > com.ibm.faces.portlet.PortletVariableResolver

</ variableresolver >

Additional changes in case of custom portlet class:

If the Generate Custom Portlet Class option is selected while creating the portlet project, the following changes are needed in addition to the ones mentioned in section

II:

1.

The portlet-class entry in the portlet.xml need not change, as a custom portlet class is used.

2.

Modify the portlet class to extend javax.portlet.faces.GenericFacesPortlet class from the JSR 301 portlet bridge instead of com.ibm.faces.portlet.FacesPortlet

3.

The processAction() method in the portlet class needs to be changed as follows: public void processAction(ActionRequest request, ActionResponse response) throws PortletException ,IOException { super.processAction(request, response);

}

4 . Delete the doConfigure() method in the portlet class if a custom portlet class is present for the portlet.

Additional changes in case of custom portlet modes:

If edit , help config and edit_defaults modes are selected in the portlet project wizard, that is, if the portlet has these custom modes, then perform the following steps in addition to the steps in section II.

1.

Modify the portlet mode ID in the portlet.xml for the edit and help modes from < init-param >

< name > com.ibm.faces.portlet.page.edit

</ name >

< value > /TestJSR301Edit.jsp

</ value >

</ init-param >

< init-param >

< name > com.ibm.faces.portlet.page.help

</ name >

< value > /TestJSR301Help.jsp

</ value >

</ init-param > to < init-param >

< name > javax.portlet.faces.defaultViewId.edit

</ name >

< value > /TestJSR301Edit.jsp

</ value ></ init-param >

< init-param >

< name > javax.portlet.faces.defaultViewId.help

</ name >

< value > /TestJSR301Help.jsp

</ value ></ init-param >

2.

Delete the following init-params mentioned for config and edit_defaults mode in the portlet.xml. These are not supported by the JSR 301 portlet bridge.

< init-param >

< name > com.ibm.faces.portlet.page.config

</ name >

< value > /TestJSR301Config.jsp

</ value >

</ init-param >

< init-param >

< name > com.ibm.faces.portlet.page.edit_defaults

</ name >

< value > /TestJSR301EditDefaults.jsp

</ value >

</ init-param >

3.

Delete the doConfigure() method in the portlet class if a custom portlet class is present for the portlet.

4.

Delete the following methods from the custom portlet class. These methods are for handling the custom portlet modes that are not supported by the JSR 301 bridge. protected void doDispatch(RenderRequest request,

RenderResponse response) throws PortletException, IOException

{ if

(!WindowState.

MINIMIZED .equals(request.getWindowState())){

PortletMode mode = request.getPortletMode(); if ( CUSTOM_CONFIG_MODE .equals(mode)) { doCustomConfigure(request, response); return ;

} else if ( CUSTOM_EDIT_DEFAULTS_MODE .equals(mode)) {

}

} super .doDispatch(request, response);

} doCustomEditDefaults(request, response); return ; protected void doCustomEditDefaults(RenderRequest request, RenderResponse response) throws PortletException,

IOException { super .doDispatch(request, response);

}

protected void doCustomConfigure(RenderRequest request, RenderResponse response) throws PortletException,

IOException {

} super .doDispatch(request, response);

NOTE : The options available in the Advanced Settings of the portlet project wizard are not supported by the JSR 301 portlet bridge. These may not work as expected when used with this portlet bridge.

Download