Hello Kevin,

First of all, it's easier to get the request map from the ExternalContext:

Map requestMap = externalContext.getRequestMap();

However, if you still can't find the key, it may be an issue with the
Liferay portlet bridge. I would suggest asking about it in their forums to
make sure they're propogating those keys to the ExternalContext properly.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann ([EMAIL PROTECTED])
Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

> -----Original Message-----
> From: Kevin Irmscher [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 04, 2007 7:47 AM
> To: [email protected]
> Subject: Access portal user information in JSF Portlet application
> 
> Hi,
> 
> I have a JSF application in a Liferay Portal rendered as portlet using
> MyFacesGenericPortlet class. I want to access user information that is
> provided by the portal.
> 
> In a normal portlet application they can be accessed using
> javax.portlet.RenderRequest.getAttribute(PortletRequest.USER_INFO);
> in the render phase.
> 
> I tried it like that:
> FacesContext fc = FacesContext.getCurrentInstance();
> PortletRequest request = (PortletRequest)
> fc.getExternalContext().getRequest();
> Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO);
> String name = (String) userInfo.get("user.name.given");
> 
> The map does not contain a user.name.given key so name is null.
> 
> Has anyone an idea how to solve that?
> 
> Regards, Kevin

Reply via email to