Are you using liferay's database services?
- I'm pretty sure you can get the user from the request... the
request processor puts it there...
- PortalUtil.getUser(...) has a number of ways of giving you the user...
- Have you looked at the different methods in UserLocalServiceUtil ?
Hope this helps!
On May 8, 2007, at 8:57 AM, Kevin Irmscher wrote:
Hi,
thank you all very much for the information and sorry for the
double posting.
Unfortunately I still can't get user information like name or email
address.
(String) userInfo.get("liferay.user.id") and
PortletRequest.getRemoteUser() return a user id (here: liferay.com.1)
but not the actual name of the user.
Neither can I retrieve the information using
Map requestMap = externalContext.getRequestMap()
I can also do the cast to RenderRequest
RenderRequest request = (RenderRequest) fc.getExternalContext
().getRequest()
but that doesn't help either.
I can see all attributes if I use a portlet implementation without JSF
so It must have something to do with the MyFaces implementation.
Regards,
Kevin
I'm sortof split on this. Since it's an attribute, he should just
use
the EC, it's cheaper and more robust then the cast. If he needed
something ELSE on the native object that the EC didn't provide,
casting
is the only option.
That said, Kevin, are you sure you have a RenderRequest? Bridges
will
serve you a render request on the first complete lifecycle and then a
combination of action/render requests for additional lifecycles. I
noticed that you were casting to the PortletRequest which is the
common
ancestor for both yet that parameter is only available on the render
request.
If you change you cast to RenderRequest and get a ClassCastException
then you'll know your in the wrong class. In general you can only
count
that you have a render request during the render phase of the JSF
lifecycle. Every other phase may have either/or...
Hope this helps,
Scott
Ryan Wynn wrote:
On 5/4/07, Nebinger, David <[EMAIL PROTECTED]> wrote:
> First of all, it's easier to get the request map from the
> ExternalContext:
>
> Map requestMap = externalContext.getRequestMap();
For the http request parameters, sure you're correct. But he's
got a
portlet and he's looking for a portlet request parameter, so he's
going
about things the correct way.
MyFacesGenericPortlet creates a special derivation of ExternalContext
for you that wraps the portlet request (and portletSession, etc). So
getRequestMap() is going to give you a map backed by the
portletRequest parameters. In essence alot of stuff works no matter
what container you are in, as long as you don't cast to container
specific classes. So I would agree with Kito on the first point and
not cast specifically to PortletRequest.