Creating a Tomcat Virtual Context Root in a Grails App

Today, I wanted to do some debugging of an ExtJS app that uses Grails. In the past, I would have just copied and pasted the ExtJS source files into my Grails webapp folder. But today, I decided there has to be a way to set up a mapping in Tomcat to point to my ExtJS source folder without having to copy and paste it into my webapp folder. And indeed there is!

In case anyone ever wants to do something similar, you create (or edit) an _Events.groovy file in your /scripts directory which contains code like this:

Not quite as simple as I had hoped, but not too bad either. :-)

Brian has been developing web applications for over 14 years, primarily using Java, Groovy, .NET, ColdFusion, ExtJS, Flex, and AIR. He's worked as a consultant or employee on a wide range of projects for private companies and government agencies. Brian is a regular speaker at industry conferences, as well as a blogger and author. He has contributed to a number of community endeavors, including DeftJS, Swiz, Fusebox, ColdSpring, and several RIAForge projects.

Tagged with: ,
Posted in Groovy/Grails, HTML RIA Development, Life After Flex
6 comments on “Creating a Tomcat Virtual Context Root in a Grails App
  1. Hi Brian. Are you going through this because you don’t have something like Apache in front of Tomcat in your dev environment? Also, I’ve often used a symbolic link for stuff like this. I’m on Linux, but I know OSX supports symlinks, and I think I recall hearing that Windows now has something similar (albeit with some expected caveats). Cheers.

  2. Brian Kotek says:

    Right, Jamie. We’re using the built-in, self deploying Tomcat instance. Basically, the standard setup you do run-app in development mode (which if I recall uses Jetty). So Apache isn’t being used.

  3. ac says:

    Love this blog and all the grails articles here. We are jumping on a new project with extjs and grails for the first time. Can you please please nlighten us with some of the gotchas and best practices ? More from a continuous integration , automated testing and migration perspective? Any major architectural tips? Thanks in advance !

  4. Brian Kotek says:

    That’s a pretty wide set of topics, AC. If you can elaborate or give some specifics on what you’re looking for, maybe it will give me some ideas to address in future posts.

  5. Thanks so much for posting this — you solved my exact problem!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>