2 Replies Latest reply on Jun 16, 2011 12:44 AM by yazee29

    PortletRequest.USER_INFO returns nothing

    rob_gar_esp

      Hi,

      I'm trying to retrieve user information from the PortletRequest.USER_INFO attribute, however it returns nothing all the time. The complete snippet is:

      protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException {
      
       Map userInfo = (Map)rRequest.getAttribute(PortletRequest.USER_INFO);
       Set<String> keys = null;
       if (userInfo!=null) {
       keys = userInfo.keySet();
       logger.info("userInfo.size()=" + userInfo.size() );
       } else {
       logger.info("user info is null");
       }
       if (keys!=null){
       for (String key : keys) {
       logger.info("These are the keys: " + key );
       }
       for (String key : keys) {
       String[] arr = (String[])userInfo.get(key);
       for(int i=0;i<arr.length;i++){
       logger.info("Param: " + key + ", value[" + i + "]= " + arr);
       }
       }
       }



      My portlet.xml contains:

      <user-attribute>
       <description>User Name</description>
       <name>user.name</name>
       </user-attribute>
       <user-attribute>
       <description>User Id</description>
       <name>user.id</name>
       </user-attribute>



      Also, the users in the admin console have basic information such as names, timezone, languagel locale and the rest of the properties, but it just does not work.

      What's wrong?

      Thanks in advanced