private static void extractModuleViews(String viewsLocator, List<String> result)
{
viewsLocator = viewsLocator.substring(1);
int index = viewsLocator.indexOf("/");
String moduleId = viewsLocator.substring(0, index);
Module module = Modules.getInstance().getModule(moduleId);
if (module == null)
{
throw new ViewException("Invalid module ["+moduleId+"] referenced by the view locator expression ["+viewsLocator+"]");
}
if (viewsLocator.length() > index +1)
{
viewsLocator = viewsLocator.substring(index+1);
if (isViewName(viewsLocator))
{
List<URL> urls = views.get(viewsLocator);
if (urls != null)
{
for(URL url: urls)
{
if (Modules.getInstance().isResourceOnModulePath(url, moduleId))
{
result.add(viewsLocator);
}
}
}
}
else
{
URL rootURL = Modules.getInstance().getModuleRootURL(moduleId);
URLResourceHandler urlResourceHandler = URLResourceHandlersRegistry.getURLResourceHandler(rootURL.getProtocol());
FilePatternHandler handler = new FilePatternHandler(viewsLocator, null);
for (String path : module.getPublicPaths())
{
URL modulePublicPath = urlResourceHandler.getChildResource(rootURL, path);
extractFolderViews(result, modulePublicPath, handler);
}
}