tags:

views:

286

answers:

1

By default, Grails uses lowerCamelCase for the URL's. While this isn't a big deal, I sort of favor the the all lowercase URL design, which also reduces gotchas from "normal" people not realizing that case can sometimes make a difference.
I could use the custom mapping to add lowercase versions of all of my controllers (which I do in some cases) but that sort of goes against the general idea of letting Grails do stuff for me.

So, is there a way to tell Grails to use lowercase mappings by default or what would be a good Grailsy way to accomplish this feature?

Note: I'm not necessarily against leaving URL parameters in camel case however, just the base URL of controller/action part.

Note: Due to an answer below, this question is specific to Grails 1.1.0.

+1  A: 

Strange, my grails 1.1.1 does use all lowercase for the URL part of the URL mappings by default. My URLs' action and controller parts are lowercase already.

Can you post your grails-app/conf/UrlMappings.groovy file?

Sean A.O. Harney
I'm still on 1.1.0, let me try to upgrade and see if it's the same. Otherwise, I'll have to change my question to ask where the setting to control it is, since my current apps are camel case.
tgm
I just tried a new 1.1.1 app and it's doing the same thing. A fresh app with two domain classes 'Customer' and 'ServiceOrder' and the URL's are customer and serviceOrder by default for me.
tgm
Can you post your grails-app/conf/UrlMappings.groovy file? The standard behavior is that a controller with class SomethingController would have the mapping /something
Sean A.O. Harney
What are you controller classes in grails-app/controller/ ?
Sean A.O. Harney
Controller classes match the domain classes. i.e. ServiceOrderController which maps to /serviceOrder on the URL. It's the multi-word controllers that behave this way, single word are fine (like FooController) but not FooBarController which would map to /fooBar.
tgm
I'm using 1.1.1 and also get lowerCamelCase URLs. Here's my UrlMappings.groovy file. class UrlMappings { static mappings = { "/$controller/$action?/$id?"{ constraints { // apply constraints here } } "/"(view:"/index") "500"(view:'/error') } }
Cesar