USING PUMA SERVICE
//You can call in your do view method,you can simply use the below code
import com.ibm.portal.portlet.service.PortletServiceHome;
import com.ibm.portal.portlet.service.PortletServiceUnavailableException;
import com.ibm.portal.um.PumaProfile;
import com.ibm.portal.um.portletservice.PumaHome;
private void getUserId(RenderRequest request)
throws PortletServiceUnavailableException {
PortletServiceHome psh = null;
try {
javax.naming.Context ctx = new javax.naming.InitialContext();
psh = (PortletServiceHome) ctx
.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
} catch (NamingException e) {
}
PumaHome service = (PumaHome) psh.getPortletService(PumaHome.class);
PumaProfile pp = service.getProfile(request); // get the use PumaProfile
// object
try {
System.out.println(pp.getCurrentUser());//gives the complete information
} catch (com.ibm.portal.um.exceptions.PumaException e1) {
e1.printStackTrace();
}
}
//You can call in your do view method,you can simply use the below code
import com.ibm.portal.portlet.service.PortletServiceHome;
import com.ibm.portal.portlet.service.PortletServiceUnavailableException;
import com.ibm.portal.um.PumaProfile;
import com.ibm.portal.um.portletservice.PumaHome;
private void getUserId(RenderRequest request)
throws PortletServiceUnavailableException {
PortletServiceHome psh = null;
try {
javax.naming.Context ctx = new javax.naming.InitialContext();
psh = (PortletServiceHome) ctx
.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
} catch (NamingException e) {
}
PumaHome service = (PumaHome) psh.getPortletService(PumaHome.class);
PumaProfile pp = service.getProfile(request); // get the use PumaProfile
// object
try {
System.out.println(pp.getCurrentUser());//gives the complete information
} catch (com.ibm.portal.um.exceptions.PumaException e1) {
e1.printStackTrace();
}
}
No comments:
Post a Comment