views:

130

answers:

2

Grails, by default, is case-sensitive when mapping URL to controller actions or views.

For instance, www.mywebsite.com/book/list will work BUT www.mywebsite.com/Book/list will return a 404 page.

What can I do (code snippets are welcomed) to make my URL case-insensitive (i.e. www.mywebsite.com/Book/list being a valid url) ?

A: 

Just a shoot from the hip, try the following:

static mappings = {
"/$controller/$action?/$id?"{
    controller = controller.toLowerCase()
    action = action.toLowerCase()
}
Stefan
Not working : even wors, it throws an exception !
fabien7474
+2  A: 

i posted the code to solve this problem here

http://clearlyinnovative.posterous.com/case-insensitive-url-mappings-in-grails

Aaron Saunders
@Aaron, you deserve some check-mark love for this answer....
hvgotcodes
Thank you veyr much for your solution. I will try it someday and post my results on this thread. Currently, I don't have time to work on that.
fabien7474
Also quite disappointing to see that there is no "simple" built-in grails solution for a very simple and common problem
fabien7474