Re: [uportal-dev] uPortal 4 portlet, get IPerson attributes in portlet RenderRequest

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [uportal-dev] uPortal 4 portlet, get IPerson attributes in portlet RenderRequest

Lauren Anderson

I figured it out. For anyone who cares to know, the RenderRequest.getAttribute(PortletRequest.USER_INFO) in the portlet controller has a Map of key/value pairs with the extra personal information I need. I just access it like this:

 

 

@RenderMapping

public ModelAndView showMainView(final RenderRequest request, final RenderResponse response) {

 

    /* Get the USER_INFO from portlet.xml, which gets it from personDirectoryContext.xml */

 

    final Map<String, String> userInfo = (Map<String, String>) request.getAttribute(PortletRequest.USER_INFO);

 

    /* Show all key/value pairs in USER_INFO ("javax.portlet.userinfo") */

 

    log.debug("---USER_INFO---");

    for (Map.Entry<String, String> entry : userInfo.entrySet()) {

        log.debug(entry.getKey() + "=" + entry.getValue());

    }

 

    /* Get the byuId from USER_INFO map. */

 

    final String byuId = userInfo.get("byuId");

    log.debug("byuId is " + byuId);

 

    ...lots of other code here...

}

 

 

 

Lauren

 

 

From: <[hidden email]> on behalf of Lauren Anderson <[hidden email]>
Date: Thursday, September 17, 2020 at 4:54 PM
To: "[hidden email]" <[hidden email]>
Subject: [uportal-dev] uPortal 4 portlet, get IPerson attributes in portlet RenderRequest

 

Sorry to bring up the ugly JSR-286 portlet spec, but we’re still using uPortal 4. Do any of you know if it’s possible to get the IPerson attributes when you render the portlet view, and if so, how to do it? I’d like to use them in an API call for the portlet.

 

Some background: the queryAttributeMapping in personDirectoryContext.xml maps some attributes (byuId, personId) for the signed-in user that I’d like to access when I render the portlet, but I don’t know how to get them.

 

Lauren

 

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/uportal-dev/82828FA2-3C39-4C8D-A411-D3AE97A58F06%40byu.edu.

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/uportal-dev/295403E8-0DA3-4C71-AC7B-D99236AC5269%40byu.edu.