Custom portlet service - usage and implementation

Concept:- Accessing a portlet service requires a JNDI lookup for a PortletServiceHome. To use the portlet service, you retrieve a service object from the home, cast it to the service-specific interface and invoke service methods.
Let us talk about a scenario where implementation of custom portlet service solved my use case.

I had a use case where in, i was required to create a variable and make it available globally across the portal.

In detail, i wrote my own login portlet for wps 6.1.0.1 and when user hit my portlet using url http://localhost:10040/wps/InvokePortalLogin/InvokeLoginServlet?ID=5678
here i retrieve this ID in my servlet which is part of login portlet app, and redirect to portlet using IBM's Advance generation URL helper classes.
Now i was required to store this ID in login portlet in such a location so that it should be available to all the portlet apps deployed on portal.
I achieved this by creating a custom portlet service and put this data into HashMap ( there is mapping of userid as key and ID as value in map )using service methods.

Now whichever portlets need this ID after authentication, just lookup this service and call service methods to get ID of the logged in user.
things you should have knowledge of to implement usecase similar to above are
a) basic Java, J2EE concepts and Portal concepts, specially WPS
b) Login Portlet Customization
c) URL Generation API's
d) Portlet service concept
e) Custom Portlet Service concepts

1 comment:

Anonymous said...

Could you please provide us steps for customized login portlet customization along with TAM WebSeal integration or only the first one