You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by carminux <ca...@gmail.com> on 2005/11/02 12:53:35 UTC

J2 getUserName ?

hi to everybody, I'm newbie in portal development.
I want to build a portlet for jetspeed 2 that visualizes the name of
the user that has effected the login in the portal.
Does a method exist similar to getUserName ( )?

thanks to everybody.


public class Hello extends GenericPortlet{

public void init(PortletConfig portletConfig) throws
UnavailableException, PortletException
  {
    super.init(portletConfig);	
  }
	
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException
  {
    String user= getUserNane(); //??
    System.out.println("user is: "+user);
  }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: J2 getUserName ?

Posted by Aaron Evans <aa...@yahoo.ca>.
Martin Dulisch <mdulisch <at> gmail.com> writes:

> 
> Have a look at PortletRequest.getRemoteUser
> 
> Martin

Right. You can also leverage getUserPrincipal and isUserInRole.

These are also be available in the RenderRequest so you could do this right in
your JSP (that is, provided the user Principal object is not null):

<%= renderRequest.getUserPrincipal().getName() %>

Have a look at the demo portlet webapp that ships with J2 for examples...


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: J2 getUserName ?

Posted by Martin Dulisch <md...@gmail.com>.
Have a look at PortletRequest.getRemoteUser

Martin


On 11/2/05, carminux <ca...@gmail.com> wrote:
> hi to everybody, I'm newbie in portal development.
> I want to build a portlet for jetspeed 2 that visualizes the name of
> the user that has effected the login in the portal.
> Does a method exist similar to getUserName ( )?
>
> thanks to everybody.
>
>
> public class Hello extends GenericPortlet{
>
> public void init(PortletConfig portletConfig) throws
> UnavailableException, PortletException
>   {
>     super.init(portletConfig);	
>   }
> 	
> public void doView(RenderRequest request, RenderResponse response)
> throws PortletException, IOException
>   {
>     String user= getUserNane(); //??
>     System.out.println("user is: "+user);
>   }
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org