Grails - Subdomain Based Projects and Links

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?

+5
source share
2 answers

grails, project , TagLib <g:project bean="myproject"/> ()

tagLib gsp , - DRYer, .

, ,

.

+1

.

a) - (Apache - ) - URL-. : .

b) . HTTP- ( ). URL-, Grails - , .

0

All Articles