Error in Grails documentation of URL Mappings exclude

In 6.4.6 Mapping Wildcards is written that you exclude URIs like this:

static excludes = ["/images/**", "/css/**"]

But this didn’t work for me. Looking at the source code (UrlMappingsFilter) I found out, that the exclude is no wildcard pattern matching and only a startsWith matching:

for (String excludePattern:excludePatterns){
    if (uri.equals(excludePattern)||
        processFilterChain(request, response, filterChain);

So the correct way is with one asterisk:

static excludes = ["/images/*", "/css/*"]

3 Responses to “Error in Grails documentation of URL Mappings exclude”

  1. Tim Says:

    Thanks for the blog post, Martin! I just ran into this problem myself with Grails 1.2 – really messes with your brain when something is documented as working, but doesn’t. Thanks for digging in and having a look at the source.

    Is there a bug entered for this in the Grails Jira?


  2. Martin Hofmann Says:

    Hi Tim,
    without checking I assumed there would be a ticket. But after checking JIRA, I saw that there wasn’t one. So thanks for the comment. I raised now a bug:

    Regards Martin

  3. Martin Hofmann Says:

    The documentation was corrected in version 1.3.2.
    Thanks to Burt Beckwith.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: