*/
@Override
public Template createTemplate(Resource resource, final boolean cacheable) {
if (resource == null) {
GrailsWebRequest webRequest = getWebRequest();
throw new GroovyPagesException("No Groovy page found for URI: " + getCurrentRequestUri(webRequest.getCurrentRequest()));
}
//Yags: Because, "pageName" was sent as null originally, it is never go in pageCache, but will force to compile the String again and till the time this request
// is getting executed, it will occupy space in PermGen space. So if there are 1000 request for the same resource at a particular instance, there will be 1000 instance
// class in PermGen instead of ideally being 1 as they as essentially same resource.
//we will cache metaInfo only is Developer wants-to. Developer will make sure that he creates unique key for every unique pages s/he wants to put in cache
final String pageName = establishPageName(resource, cacheable);
try {
return createTemplate(resource, pageName, cacheable);
}
catch (IOException e) {
throw new GroovyPagesException("Error loading template", e);
}
}