开发者

Deploy Grails to a Sub-Context Path

I would like to deploy a grails war to a sub context path but when I try this the application will not load and an error filterStar开发者_如何学Got so I'm either missing something or grails can't be deployed to a sub-context. Is there any way to load grails in a sub context?


I thought I'd leave an answer here for anyone who comes along since I've been trying to solve this problem myself.

One trick is to set use the hash/pound sign (#) in the .war file name:

api#1.2.war

Which results in the following app context:

http://localhost:8080/api/1.2/

I've tested this in Tomcat 7.

One reason why I wanted this is so that I can automatically ship different versions running side by side with the following grails BuildConfig.groovy:

grails.project.war.file = "target/api#${appVersion}.war"

This works great with Tomcat 7, I'm unsure about other versions.

However, what I would really like to do is set it up so that Tomcat uses the context from my Grails Config.groovy or application.properties files.

Update 1: I'm using Grails 1.3.7.

Update 2: Successfully tested by user miek in Tomcat 6. Thanks miek!


Just a shoot from the hip: add a file /web-app/META-INF/context.xml to your application with these contents:

<Context path="/ex/sub" />

I'm not sure if that works, but it's worth a try.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜