Search code examples
grailsgrails-controller

Can Grails Controller name have number in it


Can I have a grails controller named Office365Controller. More specifically is it allowed to have numbers in controller names? In url mapping i use office365 as controller. Could this be somehow conflicting with camel casing convention used for controller.

I ask this question because when i call a function inside this controller, i get tomcat error 403. My all other controllers are working fine and security for all of them is same.


Solution

  • Can I have a grails controller named Office365Controller.

    Yes.

    More specifically is it allowed to have numbers in controller names?

    Yes.

    I ask this question because when i call a function inside this controller, i get tomcat error 403.

    There may be some other factor in your app that is causing the issue, but I don't think the numbers in the controller name would cause a 403. A controller like this should work fine:

    class Office365Controller {
    
        def index() {
            render retrieveSomeValue()
        }
    
        protected retrieveSomeValue() {
            'hello world'
        }
    }
    

    It isn't clear what might be going wrong in your app, but the answer to the questions quoted above is "yes".