I want to know programmatically if a view or a layout exists in grails.
I am thinking in obtain the absolutepath and ask for File.exists but I don’t know how to obtain this path for every enviroment.
I had tried groovyPagesTemplateEngine.getUriWithinGrailsViews('a-view.gsp') without success.
Can you give me any pointer?
thanks in advance
I see 2 possibilities
Search for view file
If you build a war file you will see that views are stored in WEB-INF/grails-app/views. You can search for that resource.
Use PathMatchingResourcePatternResolver
Find a inspiration in assertView method of GrailsUrlMappingsTestCase.