Tuesday, 20 September 2011

Important method of com.ibm.wps.pb.utils.portlet. PortletUtils in Websphere portal server 6.1.5

PortletUtils is a utility class which is provided by websphere portal server. With help of JSR286, it provides some method which really useful. 

getPortletDefinitionId(PortletConfig portletconfig)
            String portletUniqueName = "";
            ObjectID objID = PortletUtils.getPortletDefinitionId(getPortletConfig());
             if(null != objID) {
                                    portletUniqueName = objID.getUniqueName();
            }
getPortletDefinitionId(javax.portlet.PortletRequest portletrequest)
String portletUniqueName = "";
            ObjectID objID = PortletUtils.getPortletDefinitionId(request)
             if(null != objID) {
                                    portletUniqueName = objID.getUniqueName();
            }
getHttpServletRequest(javax.portlet.PortletRequest portletrequest)
http://localhost:10039/wps/myportal/!ut/p/b1/pZBNC4JAEEB_Uczsuu6ux61w3RQpK8q9xBIigh-XCPr3aXR1PTi3gfdm4IGFkkjGqOCCCLiD7d27qd2rGXrXTrvlj51WCRMZogwlQaOSq-DnPZVIR6CcB3RBV_q4yscT8_k6wwVfBT_fqOKQp5qg1Jyiia5qK9IjQSbgBtb7YirgB_AP4MwoXLhwCf3AVCFPhq6CcsTEfM0Ayraq3fMDnW3jOI5MYzbxF-V0wxc!/dl4/d5/L2dJQSEvUUt3QS80SmtFL1o2X0NHQUg0N0wwMDg1ODEwSUFIVTc2U0QyMEEz/?test=sample
HttpServletRequest req=PortletUtils.getHttpServletRequest(request);
System.out.println("req.getParameter('test'):"+req.getParameter("test"));  // sample is printed.

getHttpServletResponse(javax.portlet.PortletResponse portletresponse)
HttpServletResponse req=PortletUtils.getHttpServletRequest(response);

getUser(javax.portlet.PortletRequest portletrequest)
User user= PortletUtils. getUser (request);

getPageId(HttpServletRequest httpservletrequest)
String pageuniquename = "";
                        ObjectID objID = PortletUtils.getPageId(req);
                         if(null != objID) {
                                     pageuniquename = objID.getUniqueName();
                        }

No comments:

Post a Comment