Skip to main content

developerWorks >  WebSphere  >  Forums  >  WebSphere Portal  >  developerWorks

Getting a page's localized name from Portal Server given page's unique name    Point your RSS reader here for a feed of the latest messages in this thread


Tags for this thread: 

     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
This question is not answered.

Permlink Replies: 0 - Pages: 1
kjava96

Posts: 2
Registered: Nov 08, 2009 05:05:47 PM
Getting a page's localized name from Portal Server given page's unique name
Posted: Nov 09, 2009 01:38:31 AM
 
Click to report abuse...   Click to reply to this thread Reply
Hello.

If I have a page's unique name, how can I obtain its localized name from Websphere Portal Server?

I tried creating a Method build in my portlet and specifying the below code, but it did not work.

try {
   Context ctx = new InitialContext();
   PortletServiceHome psh = (PortletServiceHome)ctx.lookup("portletservice/com.ibm.portal.portlet.service.model.ContentModelProvider");
   // the above call isn't working, but if it was, the following was going to be attempted
   ContentModelProvider provider = (ContentModelProvider) psh.getPortletService(ContentModelProvider.class);
   ContentModel model = provider.getContentModel(renderRequest, renderResponse);
   Locator locator = model.getLocator();
   ContentPage cPage = locator.findByUniqueName(aUniquePageName);
   String pageLocalizedTitle = cPage.getTitle(Locale);
}
catch (Exception e) {
   ...
}

The above code was adapted from the sample on Websphere Portal 6.1.0 InfoCenter on this page:

Link: http://publib.boulder.ibm.com/infocenter/wpdoc/v6r1/index.jsp?topic=/com.ibm.wp.ent.doc/dev/dgn_ptl.html

WebSphere Portal 6.1.0 > Developing portlets > Model SPI overview > Obtaining a model from the portal


The above ctx.lookup(..) call results in the following exception:

java.lang.ClassCastException: com.ibm.wps.services.portletserviceregistry.home.PortletServiceHomeImpl incompatible with com.ibm.portal.portlet.service.PortletServiceHome

Any help would be greatly appreciated.

K

 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums