tags:

views:

37

answers:

2

I created a class under 'src' dir. I'm using this code to access the 'images' directory for all files inside 'grails-app':

ApplicationHolder.application.parentContext.getResource("file/misc").file;

I'm having this error when I access it in a 'src' class:

application has private access in org.codehaus.groovy.grails.commons.ApplicationHolder

Any comment on why is this happening? How can I access "file/misc" when app is deployed to tomcat?

A: 

Looks like I solved it already:

ApplicationHolder.getApplication().getParentContext().getResource("file/recsys").getFile();

I'm getting used to Groovy syntax, starting to forget regular Java methods. Sorry.

firnnauriel
A: 

From GSP pages, you can do

${resource(dir: 'images', file: 'example.gif')}

armandino