} else {
// read as resource
tagContent = getServletResourceAsString(filePath);
}
if (tagContent == null) {
throw new TemplateFileNotFoundException("File " + filePath + " not found.");
}
// add to cache
StringBuilder tagContentStringBuilder = new StringBuilder(tagContent);
ResourceCache.getInstance().putTemplate(cacheKey, tagContentStringBuilder);
// keep the method here in case we disable cache
return tagContentStringBuilder;
} catch (TemplateFileAccessException e) {
throw new TemplateFileNotFoundException("File " + filePath + " not found.", e);
} catch (AFFileNotFoundException e) {
throw new TemplateFileNotFoundException("File " + filePath + " not found.", e);
}
}
return ResourceCache.getInstance().getTemplate(cacheKey);
} else {
return null;