Posts

Showing posts from June, 2008

Grails, favicon, and urls

I've just spent a little too much time trying to get my favicon working properly on a new grails application. The issue I encountered was due to the fact that I wanted users to be able to access their accounts using '/[username]' - i.e. /paul To accomodate this, I used a UrlMapping: "/$id" { controller='display' action:'index' } Now, this meant that /favicon.ico would hit the controller, and not server the icon file. I first thought I could get around this by constraining the above mapping - so I tried: "/$id" { controller='display' action:'index' constraints { id(notEqual:'favicon.ico') } } It seems though that the only constraint you can use is 'matches'. At least 'notEqual' resulted in a compile error, and all of the examples use 'matches'. So I thought I'd use matches with a regular expression of to exclude the word 'favicon.ico' - turns out that ma