Version 2



    This Gadget uses GWT and access the Organization service to display some information about a user.


    Portlets by default allow for a wide range of access to useful information about the user and the portal environment its running in. With GateIn, a portlet also has easy access to a Portlet or Portal RequestContext to access GateIn specific services.


    A gadget on the other hand has a bit more difficultly accessing this information. It doesn't have the same access to kind of information that a portlet usually does, and it doesn't have access to the Portlet or Portal RequestContext.


    Since a gadget is normally run as javascript inside the browser of a client, we need to have a server side component to access the portal environment information. A GWT gadget using an RPC component will allow for us to easily have this server side component.


    For information on how to get started using GWT and Google Gadgets please see


    Attached to this wiki article is a simple gwt gadget example that will show a welcome message with the users first name and the last time they logged into the server. The example has a simple client interface that will access this information from a servlet using RPC.

    Getting Portal Information from a Servlet

    Its easy enough to get most of the GateIn services from a servlet if its running on the same server. Most of these services are available directly from the eXoKernel or from a factory's getInstance method.


    In our example we get an instance of the PortalContainer and then use the PortalContainer to get access to the OrganizationService (internally via the eXoKernel):


    PortalContainer portalContainer = PortalContainer.getInstance();
    OrganizationService orgService = portalContainer.getComponentInstanceOfType(OrganizationService.class);


    Once we have access to the OrganizationService we can get access to a User object which will contain information about a user:




    The problem is getting access to the username. This information is coming from a servlet via ajax and is not being run inside the portal environment. In order to get the username we can have the servlet use the same realm as GateIn and enable the SingleSignOn valve so that they will share login details.


    In the servlet's web.xml set up the same realm as GateIn:




    In the servlet's jboss-web.xml setup the same realm as GateIn:




    Once we have this setup, within our servlet we can use the remote user name from the GWT threadRequest:




    Installation procedure

    Build system: Maven

    Source location: Attached file

    Compatibility list (please add to this list if you have tested a new version of GateIn):

    TesterVersion of the exampleVersion of GateInResultComment