protected final String loadAndMergeManifests ( final String baseUrl , final String moduleName , final String ... permutationNames ) throws ServletException { final String cacheKey = toCacheKey ( baseUrl , moduleName , permutationNames ) ; if ( isCacheEnabled ( ) ) { final String manifest = _cache . get ( cacheKey ) ; if ( null != manifest ) { return manifest ; } } final ManifestDescriptor descriptor = new ManifestDescriptor ( ) ; for ( final String permutationName : permutationNames ) { final String manifest = loadManifest ( baseUrl , moduleName , permutationName ) ; final ManifestDescriptor other = ManifestDescriptor . parse ( manifest ) ; descriptor . merge ( other ) ; } Collections . sort ( descriptor . getCachedResources ( ) ) ; Collections . sort ( descriptor . getNetworkResources ( ) ) ; final String manifest = descriptor . toString ( ) ; if ( isCacheEnabled ( ) ) { _cache . put ( cacheKey , manifest ) ; } return manifest ; }
Utility method that loads and merges the cache files for multiple permutations . This is useful when it is not possible to determine the exact permutation required for a client on the server . This defers the decision to the client but may result in extra files being downloaded .