Showing posts with label jsr286. Show all posts
Showing posts with label jsr286. Show all posts

Monday, April 15, 2013

Sample Portlet using Web Experience Factory 8

To download Web experience Factory 8, go to
http://www.ibm.com/developerworks/downloads/ws/wpf/. Installation is fairly
simple. Now let's quickly start creating a sample Portlet.

· Create a project by clicking File>New>Web Experience Factory Project.
· In Project Name page, Enter Project Name: SampleProj
· Click Next
· In Feature Set Page, Uncheck all
· Click Finish
· Select No if prompted for "Would you like to publish project now?"
· Right Click "SampleProj"> New> Web Experience Factory Model
· Select "SampleProj"
· Click Next
· In Select Model page, Select "Main and Page"
· Click Next
· In Page Settings page, Select "Simple Page"
· Click Next
· In Save New model page, Select "models" folder and enter Model name
as "SamplePortlet"
· Click Finish
· You will have following Screen

· Now double click "SampleProject.model"
· Select "Application Tree" tab
· Select "page1"
· Click on "Add Builder Call to the Current Model"
· Select "Portlet Adapter"
· Click ok
· In the Portlet Adapter page
· Enter Name: SamplePortlet
· Portlet Title: SamplePortlet
· Portlet Description: SamplePortlet
· Click OK
· Now Right click "SampleProj">Export>Web Experience Factory Portlet
WAR
· Click Finish
· Now you could deploy the war thus obtained through Portal Web
Console.

Thursday, March 14, 2013

Piece of Content Servlet for URI resolution


From Wps 6.0.1 onwards we have URI resolution service that helps to construct preview url of the web content in a most efficient manner.

Assume that you have content in WCM in the following hierarchy.

Testlibrary
|-----Site1
            |---Sitearea1
                        |-----content1

To preview the content we could use following url



In the above /poc or /mpoc is mapped to a servlet which is part of latest URI resolution service.

Now goto the page where you added the JSR286 Web content Viewer Portlet. The beauty of this servlet is it makes use of “web content mappings” defined under the portal page properties “Advanced Options”>”Edit Web content Mappings”

Add “Sitearea1” in to the list. This will inform POC servlet that all contents under the “Sitearea1” will use this page as the target for rendering the Web contents.

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.