Gideon
Gideon

Reputation: 1517

Disable auto generation of URL in Grails

Grails always provides URL for every method in a Controller. For example, if there's a method branch() in controller repository, there would be automatically a URL for localhost:8080/project/repository/branch.

What I want is to disable this. So unless I declare that URL to URLMappings.groovy, accessing this webpage will render a 404 Error, even this Controller/method exists.

I'm using Grails 2.4.4 by the way.

Upvotes: 0

Views: 76

Answers (1)

Roman Romanovsky
Roman Romanovsky

Reputation: 578

You should remove this code, from your UrlMappings:

"/$controller/$action?/$id?(.$format)?" {
        constraints {
            // apply constraints here
        }
}

Now you will get 404 if you haven't declared mapping for each action.

Upvotes: 2

Related Questions