codeconsole opened a new pull request, #15525:
URL: https://github.com/apache/grails-core/pull/15525
Validates namespace, controller and action. If validation fails, triggers
next mapping.
```groovy
"/$namespace/$controller/$action?/$id?(.$format)?" {}
"/$controller/$action?/$id?(.$format)?"{}
"/$username"(controller: 'profile', action: 'show'
```
Without validation, you have to a do something messy like this:
```
"/$username"(ontroller: 'profile', action: 'show') {
constraints {
username(validator: { val -> !(val in reserved) })
}
}
```
I can't think why you would want to disable this feature, but it can be
disabled via:
```yaml
grails:
web:
url:
mapping:
validateWildcards: false
```
Does not affect performance:
1. Calls info.configure(webRequest) for each match — sets params on the
web request
2. Does a ConcurrentHashMap.get() for the ControllerKey lookup
3. Now additionally: info.hasWildcardCaptures() (three instanceof checks)
when the lookup misses
Steps 1 and 2 were already happening before this change. The only new cost
is step 3, which is negligible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]