Search code examples
grails

Trace $controller, $action, $id from urlmapping


Is there a way to log the urlmapping from

static mappings = {
    "/$controller/$action?/$id?"{
        constraints {
            // apply constraints here
        }
    }

    "/"(view:"/index")
    "500"(view:'/error')
}

Need to trace the $controller, $action, $id.


Solution

  • In an interceptor you can refer to controllerName, actionName and params.id and do whatever you want with that info, including logging it.