Configuring the Grails Root Application Context
By default if you create a Grails application called funkysite (i.e. you did grails create-app funkysite on the command line), then when you run your application the root context is set to /funkysite. This means that your controllers such as a UserController with a show action will be available at http://localhost:8080/funkysite/user/show. Having “funkysite” as the root context is redundant, especially if you want to host your application at http://funkysite.com/funkysite/user/show.
My preference is to just have “/” as the root application context. Fortunately, you can easily configure the root application context in Grails. All you need to do is edit conf/Config.groovy and add grails.app.context = “/”. This will set your root application context to “/”, so that the above UserController and show action will be available at http://localhost:8080/user/show.
Nice tip! What do you do when you go to deploy a WAR file then? Does it work the same way or do you have to configure something on the app server?
Mike
28 Mar 09 at 1:55 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Thanks for the tip, Being a non grails application expert, i could do the job of grails expert with the help of your tip.
Vaibhav
25 Aug 09 at 8:30 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Thank you, thank you, thank you.
Stephen
1 Dec 09 at 5:20 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Great! Very helpful,thaks
alexey
14 Dec 09 at 3:48 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Finally I found how to do this. Thank you!
Andrey
1 Jan 10 at 2:52 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
“What do you do when you go to deploy a WAR file then? Does it work the same way or do you have to configure something on the app server?”
At least for Jetty and Tomcat you just deploy your war with the magic name ROOT.war instead of e.g. funkysite.war
Ronny
27 May 10 at 12:33 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Great! None of my Grails books lost a word on this topic. Thanks a lot!
Regards
Marc O. Kneifel
14 Jul 10 at 6:09 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Sik tip brub. big up to the OG tripple OG!
sham
29 Jul 10 at 4:39 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Sik tip bruv. big up to the OG tripple OG!
sham
29 Jul 10 at 4:39 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Thanks – worked perfect for me.
John Thompson
31 Jan 11 at 1:07 am edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>
Great! Thanks
Vijay Santhanam
24 Apr 11 at 11:42 pm edit_comment_link(__('Edit', 'sandbox'), ' ', ''); ?>