public function getResourceList($folderUri = null, $recursive = false) {
        //Set whether to use the given folderuri or the default
        $folderUri = $folderUri ?: $this->defaultFolder;

        //Get the resources in the requested folder
        $return = $this->jasperClient->getFolder($folderUri, $this->useFolderCache, $this->folderCacheDir, $this->folderCacheTimeout);

        //If security is active, filter out the reports the current user cannot see
        if ($this->useSecurity) {
            $newReturn = array();
            foreach ($return as $resource) {
                if ($this->container->get('mesd.jasper.report.security')->canView($resource->getUriString())) {
                    $newReturn[] = $resource;
                }
            }
            $return = $newReturn;
        }

        //if the recursive flag is set get the contents of each folder
        if ($recursive) {
            foreach ($return as $resource) {
                if ('folder' === $resource->getWsType()) {
                    $children = $this->getResourceList($resource->getUriString(), $recursive);
                    foreach ($children as $child) {
                        $resource->addChildResource($child);
                    }
                }
            }
        }

        //Return the resource array
        return $return;
    }