Functional base url 2.3.x

fixes http://jira.grails.org/browse/GRAILS-10661

resubmitted based on 2.3.x 

(original pull request https://github.com/grails/grails-core/pull/444)