I am trying to override the default controller redirect method and cannot seem to use the next bit of code.
I created a plugin and I'm trying to use "doWithDynamicMethods" to replace the redirect.
def doWithDynamicMethods = {ctx ->
application.controllerClasses.each() { controllerClass ->
replaceRedirectMethod(controllerClass)
}
}
void replaceRedirectMethod(controllerClass) {
def oldRedirect = controllerClass.metaClass.pickMethod("redirect", [Map] as Class[])
controllerClass.metaClass.redirect = { Map args, Map params ->
}
}
Do I have a wrong signature or am I missing something? The reason I do this is to change the redirect uri if a certain condition is met, but with logging / printing operators. I see that it starts in "replaceRedirectMethod" when starting / compiling applications, but it doesn’t work. "Enter there when you redirect through the controller after the application starts.
ibuck source
share