code: private ExoContainer getContainer() throws ResourceException
     {
        ExoContainer container = ExoContainerContext.getCurrentContainer();
        if (container instanceof RootContainer)
        {
           String portalContainerName =
              portalContainer == null ? PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME : portalContainer;
           container = RootContainer.getInstance().getPortalContainer(portalContainerName);
           if (container == null)
           {
              throw new ResourceException("The eXo container is null, because the current container is a RootContainer "
                 + "and there is no PortalContainer with the name '" + portalContainerName + "'.");
           }
        }
        else if (container == null)
        {
           throw new ResourceException("The eXo container is null, because the current container is null.");
        }
        return container;
     }
docs: Gets the container from the current context