Skip to content

Commit

Permalink
fix for GRAILS-12038 - Namespaced controllers are not fowarding to co…
Browse files Browse the repository at this point in the history
…rrect view path.
  • Loading branch information
graemerocher committed Mar 5, 2015
1 parent c3e7175 commit 140a60b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,29 @@ abstract class AbstractGrailsControllerUrlMappings implements UrlMappings{
def controllerName = controller.logicalPropertyName

mappingsToGrailsControllerMap.put(new ControllerKey(namespace, controllerName, null, plugin), controller)
mappingsToGrailsControllerMap.put(new ControllerKey(null, controllerName, null, plugin), controller)

String pluginNameToRegister = plugin ? GrailsNameUtils.getPropertyNameForLowerCaseHyphenSeparatedName(plugin) : null
if(plugin) {
mappingsToGrailsControllerMap.put(new ControllerKey(namespace, controllerName, null, GrailsNameUtils.getPropertyNameForLowerCaseHyphenSeparatedName(plugin)), controller)
mappingsToGrailsControllerMap.put(new ControllerKey(namespace, controllerName, null, pluginNameToRegister), controller)
def controllerKeyWithoutPlugin = new ControllerKey(namespace, controllerName, null, null)
if(!mappingsToGrailsControllerMap.containsKey(controllerKeyWithoutPlugin)) {
mappingsToGrailsControllerMap.put(controllerKeyWithoutPlugin, controller)
mappingsToGrailsControllerMap.put(new ControllerKey(null, controllerName, null, null), controller)
}
}

for(action in controller.actions) {
def withPluginKey = new ControllerKey(namespace, controllerName, action, plugin)
def withPluginKey = new ControllerKey(namespace, controllerName, action, pluginNameToRegister)
def withPluginKeyWithoutNamespaceKey = new ControllerKey(null, controllerName, action, pluginNameToRegister)
def withoutPluginKey = new ControllerKey(namespace, controllerName, action, null)
def withoutPluginKeyWithoutNamespace = new ControllerKey(null, controllerName, action, null)
mappingsToGrailsControllerMap.put(withPluginKey, controller)
mappingsToGrailsControllerMap.put(withPluginKeyWithoutNamespaceKey, controller)
if(plugin != null && !mappingsToGrailsControllerMap.containsKey(withoutPluginKey)) {
mappingsToGrailsControllerMap.put(new ControllerKey(namespace, controllerName, action, GrailsNameUtils.getPropertyNameForLowerCaseHyphenSeparatedName(plugin)), controller)
mappingsToGrailsControllerMap.put(new ControllerKey(namespace, controllerName, action, pluginNameToRegister), controller)
mappingsToGrailsControllerMap.put(withoutPluginKey, controller)
mappingsToGrailsControllerMap.put(withoutPluginKeyWithoutNamespace, controller)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class UrlMappingsInfoHandlerAdapter implements HandlerAdapter, ApplicationContex
if (!webRequest.actionName) {
webRequest.actionName = action
}
request.setAttribute(GrailsApplicationAttributes.CONTROLLER, controller)
def result = controllerClass.invoke(controller, action)

if(actionResultTransformers) {
Expand Down

0 comments on commit 140a60b

Please sign in to comment.