I am trying to override the g: link tag so that I can prefix the extra line. Here is my code:
import org.codehaus.groovy.grails.plugins.web.taglib.*
class ApplicationTagLib {
static namespace = "g"
def link = { attrs, body ->
if("es".equalsIgnoreCase(request.stLocale.language)) {
attrs['controller'] = "es/" + attrs['controller']
}
def applicationTagLib = grailsApplication.mainContext.getBean('org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib')
applicationTagLib.link.call(attrs, body)
}
}
This works fine except that when I add "es /", the resulting path is translated to es% 2F instead of es /, which is why the link doesn't work.
Is there a way to prevent the automatic encoding of a new slash, or is there a better way to prefix this string to the controller path?
ibuck source
share