tags:

views:

855

answers:

1

Can anyone give a specific example of when the following setting in Config.groovy is used?

// set per-environment serverURL stem for creating absolute links
environments {
    production {
        grails.serverURL = "http://www.changeme.com"
    }
    ...
}

What I am looking for is a use-case where not changing the above setting will fail.

+5  A: 

It is used by some of the built-in Tag Libraries. For example, the createLink tag has an absolute attribute that can be set:

absolute (optional) - If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost: if no value in Config and not running in production.

Same attribute is used for the link and createLinkTo tags and there might be a few more.

So if you don't change the serverURL in your example, any links you create using the built-in tags specifying absolute=true will probably fail. For example, the following would resolve to http://www.changeme.com/{context}/book

<g:link controller="book" absolute="true">Book Home</g:link>
John Wagenleitner