Can Grails be configured to use all lowercase URL's?

Tag: grails Author: ccl001 Date: 2009-08-11

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.

Not exactly what you are looking for but .... in Gradle 2.2.2 you can set grails.web.url.converter = 'hyphenated' in Config.groovy which results in the URL for CamelCaseController being /camel-case.

Other Answer1

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?


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.
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.
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
What are you controller classes in grails-app/controller/ ?
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.