I ran into another problem with Grails just now.

I’m starting to separate the REST implementation of my service. I wanted to keep the default generated behaviour of the Grails views, at least for now. But the interaction of the web-application is foremost using the REST api.

Thus I wanted to add Url mappings to a /rest/ “sub-directory” of the web-app. So I have all the rest functionality using the rest/ prefix. Thus I updated my Urlmappings as such:

static mappings = {  
    "/rest/ServiceProvider/$id?" (controller:"ServiceProvider", action="rest")
    "/$controller/$action?/$id?" {
        constraints {
            // apply constraints here
        }
    } 
}

There is a problem with this, I named my domain class with a capital letter. As such my controller also starts with a capital letter. Apparently the url-mappings can’t find my controller when its specified using  a capital letter in the name. If I enter the domain-class name using lower-case letters in the url-mapping it works.

static mappings = {  
    "/rest/ServiceProvider/$id?" (controller:"serviceProvider", action="rest")
    "/$controller/$action?/$id?" {
        constraints {
            // apply constraints here
        }
    } 
}

Jira ticket: http://jira.codehaus.org/browse/GRAILS-4488

Update: I made some assumptions about the error that were untrue, you do not need to rename the controller to get the custom url-mappings to work. You just need to start the domain-class name with a lowercase letter.