Friday, March 30, 2012

Part2:iWidget - Build and deploy iWidget


Build:

  1.   Export the iwidget by right clicking on "HelloWidget" in RSA
 



  2.   Enter "HelloWidget" under Web project , enter the name of the war
     file in the Destination and click Finish
 



Deploy


  1.   Start Websphere Application Server
  2.   Launch Web console
  3.   Go to Applications > New Application> New Enterprise Application
 



  4.   Select the Local war using the Browse button and click Next
 


  5.   Select Fast Path and click Next
 



  6.   In the first step of installation, don't change anything and simply
     click Next

 



  7.   In the Second step of Installation, don't change anything and simply
     click Next
  (Note: One of the target would be Websphere Portal, this is to access
  the application from WPS)
 



  8.   In the third step, give the context root as "HelloWidget" and click
     next
 


  9.   In the fourth step, click Finish
  10.  Wait for the installation to happen
  11.  After you get message for successful installation, click on
     "Save"
 




  12.  Under Applications>Application Types> Websphere enterprise
     applications select the HelloWidget.war and click "Start"

 



  13.  To test the success of the deployment access the following url
  http://www.extremeportal.com:10000/HelloWidget//HelloWidget.xml

  (Make sure you are using correct hostname and port, for ports refer WAS
  Console> Environment>Virtual hosts>default_host>Host Aliases)

  14.  You should get the following screen

 






Wednesday, March 28, 2012

Part1:iWidget - Developing iWidget for wps7 using RSA

1. Open RSA in Web Perspective
2. Click File>Project



3. Select Web> iwidget (alternatively type the keyword iwidget in the
text box)


4. Choose option 2 "Web and JavaEE technologies(Ajax, HTML, CSS, JSP,
Servlet etc.)" and click Next

Note: iWidget created using the option 1: "Web technologies(Ajax, HTML,
CSS etc.)" cannot be directly exported as WAR, so in order to export it
as war chose option 2 "Web and JavaEE technologies(Ajax, HTML, CSS, JSP,
Servlet etc.)"


5. Type the project name as "HelloWidget" and click Next


6. Select iWidget type as "Simple Widget" and click Finish


7. You will have the project created in bellow folder structure


8. The Sample code HelloWidget.xml created is as bellow

<?xml version="1.0" encoding="UTF-8" ?>
<iw:iwidget id="HelloWidget" xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget"
supportedModes="view" lang="en" iScope="HelloWidgetScope">
<iw:content mode="view">
<![CDATA[
<div>Hello World</div>
]]>
</iw:content>

</iw:iwidget>

Thursday, March 22, 2012

How to create custom skin in the wps7


        1.     Setup WEBDAV for skinlist folder and open
           http://localhost:10039/wps/mycontenthandler/dav/skinlist
        2.     Copy folder "csa2.standard"  to you local directory and rename
           to "csa2.standardCustom"
        3.     Inside csa2.standardCustom/metadata edit the
           localized_xx.properties and change the value of the property
           title
 


        4.     Just for verification, lets had little customization to the
           skin by editing csa2.standardCustom/nls/skin_en.html
        5.     Add text "Title:" as shown in the bellow snippet

            <span class="lm-dynamic-title asa.portlet.title
            decoration-title">Title:<a rel="dynamic-content"
            href="lm:title"></a></span>

        6.     Move the "csa2.standardCustom" to the
           http://localhost:10039/wps/mycontenthandler/dav/skinlist
           through WEBDAV
        7.     You could double check the addition of this skin in you portal
           by going to Administration/Portal User Interface/Themes and
           Skins/Skins.



        8.     Now you could add this skin to Page Builder theme by clicking
           on "Edit theme"
        9.     Select "Page Builder – Standard Custom" (this is the tile we
           given in properties file) and click right arrow to add it to
           "Skins for this theme". Finally click OK
       



        10.    Now the skin is ready to apply for a portlet. Go the Edit
           layout for page>Appearance tab>Skin (under a Portlet)



        11.    Bellow is the screen shot of the rendering of the Portlet
           which uses this customized skin. Please note the text "Title:"
           prefixed in the Portlet title bar.

Steps to Setup WEBDAV in Windows for skinlist folder


1. Make sure your portal server is up and running
2. In Windows xp, go to My Network Places
3. Click "Add Network Place"
4. In the Welcome dialog, Click Next
5. Select "Choose another network location" In the list of service
provider and click Next
6. Enter http://localhost:10039/wps/mycontenthandler/dav/skinlist
in the Network address and Click Next
7. You will be prompted for username and password of Portal
server, enter the values and click OK
8. It would take some time to connect and it would ask for label
for this network place. Give it as "skinlist on localhost" and
click Next
9. Click Finish and Open the network place. Now you could see
bellow window

Tuesday, March 20, 2012

Dynamic Portlet Title in JSR286 portlet

Dear All,

I recently came across a need to achieve dynamic portlet title. I came across many articles and methodologies. But bellow one is the simplest and most elegant one that I used.

As per JSR286 portlet specification, we are allowed to override getTitle method of GenericPortlet

Ref: http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/GenericPortlet.html#getTitle%28javax.portlet.RenderRequest%29

so I placed following method in my Porlet Class which extends GenericPortlet


public java.lang.String getTitle(RenderRequest request) {
return "My custom title";
}


The execution of this getTitle is subject to container runtime settings. So dont forget to set javax.portlet.renderHeaders to true under container-runtime-option in portlet.xml


Now you can extend this concept by retrieving a portlet preferences and use it as portlet title.