1

I have inherited a Grails 2.2.4 UrlMappings (partially reproduced below) that I am trying to upgrade to 2.5.0.

Named mappings api0 & api2 work, but the two consecutive slashes in api1 (between $controller & $id) do not seem to be matched properly in 2.5.0 (though they were matched in 2.2.4). e.g.:

PUT /api/ticket//123.json

returns a 403, despite my controller allowing PUTs for its update action.

name api0: "/api/$controller/$id?(.$format)?" {
    action = [GET: 'show', PUT: 'update', POST: 'save', DELETE: 'delete']
    constraints {
        id(matches: /\d+/)
    }
}

name api1: "/api/$controller//$id?(.$format)?" {
    action = [GET: 'show', PUT: 'update', POST: 'save', DELETE: 'delete']
    constraints {
        id(matches: /\d+/)
    }
}

name api2: "/api/$controller/$action/$id?(.$format)?" {
    constraints {
        id(matches: /\d+/)
    }
}

I can't change the incoming URLs and/or HTTP methods (and I didn't create them), so please don't tell me to change the clients to replace the double slashes in the URLs with single slashes, or that the URLs and/or HTTP methods don't follow REST paradigms.

Vinay Prajapati
  • 7,199
  • 9
  • 45
  • 86
XDR
  • 4,070
  • 3
  • 30
  • 54

0 Answers0