Skip to main content

developerWorks >  WebSphere  >  Forums  >  IBM WebSphere Portlet Factory - Best Practices  >  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: 1 - Pages: 1 - Last Post: Nov 8, 2009 8:28 PM Last Post By: tom.b
kjava96

Posts: 10
Registered: Nov 08, 2009 05:05:47 PM
Getting a page's localized name from Portal Server given page's unique name
Posted: Nov 08, 2009 05:43:19 PM
 
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:

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

tom.b

Posts: 817
Registered: Aug 25, 2006 08:17:19 AM
Re: Getting a page's localized name from Portal Server given page's unique name
Posted: Nov 08, 2009 08:28:53 PM   in response to: kjava96 in response to: kjava96's post
 
Click to report abuse...   Click to reply to this thread Reply
That sounds more like a WebSphere Portal API question. I suggest you post that question to the WebSphere Portal forum. This forum is Portlet Factory specific.
http://www-128.ibm.com/developerworks/forums/forum.jspa?forumID=168

Tom

 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