tags:

views:

33

answers:

2

what the urls mapping processing order for the grails framework

  • "/$object/$id/$collection"

  • "/$object/$id/bar/list"

  • "/foo/$id/bar/list"

Which one will execute first. I'm getting unexpected behavior where the generic mapping seems to execute first

A: 

what do you want to achieve ?

/$object/$id/bar/list maps /foo/$id/bar/list to. But if you want any custom behavior for foo you can set constrainst for first mapping, e.g.:

/$object/$id/bar/list {
controller = "bar"
    action = "list"
    constraints {
      object(matches: /.*[^fo].*/)
    }
}

"/foo/$id/bar/list"

Regexp is not ideal but it shows basic principles

Olexandr
A: 

i believe the order will be

/foo/$id/bar/list          // 1 value to calc
/$object/$id/bar/list      // 2 value(s) to calc
/$object/$id/$collection   // all unknown values

grails documentation states the strongest will take precedent, meaning whatever does not have to be calculated at runtime.

Aaron Saunders