Grails does not support an easy way to do this. However, I managed to assemble the puzzle from the available grails methods and came to this solution:
def actions = new HashSet<String>() def controllerClass = grailsApplication.getArtefactInfo(ControllerArtefactHandler.TYPE) .getGrailsClassByLogicalPropertyName(controllerName) for (String uri : controllerClass.uris ) { actions.add(controllerClass.getMethodActionName(uri) ) }
The grailsApplication variables and the controller name are introduced by grails. Since the controller itself does not have the necessary methods, this code retrieves its controllerClass (see GrailsControllerClass ), which has what we need: property uris and getMethodActionName method
OndroMih
source share