开发者

Grails default root path

Is there a variable where we can find out the root directory of my Grails application?

I tried request.getSession().getServletContext().getRealPath("/") But shows开发者_如何学编程 tmp/App-Test-0.1/ .

My app is located in tomcat "/home/srinath/work/projects/tomcat-6.0.18/webapps/App-Test-0.1"

could any one help me .

thanks in advance, sri..


MainContext:

import org.codehaus.groovy.grails.commons.ApplicationHolder;
ApplicationContext ctx = (ApplicationContext)ApplicationHolder.getApplication().getMainContext();

Example:

ApplicationHolder.getApplication().getMainContext().getResource("/").getFile().getAbsolutePath()


You can also make the following call on grailsApplication bean

 grailsApplication.mainContext.servletContext.getRealPath('')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜