I am trying to develop a grails application with root content (for example, www.mydomain.com/about), but will also support "projects" based on the request subdomain; e.g. myproject.mydomain.com> www.mydomain.com/myproject. As a first pass, I have the following URL configuration:
"/$controller/$action?/$id?" {
...
}
"/$project/$controller/$action?/$id?" {
constraints {
}
}
The main drawback so far is that the $ project variable must be entered manually in each link (tedious, not DRY):
<g:link controller="foo" action="bar" params="${[project: params.project]}">link</g:link>
Is there a way to automatically enter the $ project parameter in all links, if present, or is there a better way to approach this problem?
source
share