codeconsole opened a new pull request, #15358:
URL: https://github.com/apache/grails-core/pull/15358
   Follow up to https://github.com/apache/grails-core/pull/15213
   
   ```groovy
   "/$controller/$action?/$id?(.$format)?"
   ```
   
   resulted in `/user.json` not matching. only `/user` would match. This fixes 
that.
   
   Is seems like the best pathway forward to support formats and string $id's 
with .'s is the following mapping:
   
   ```groovy
     // First: greedy with format constraint                                    
                                                          
     "/$controller/$action/$id+(.$format)?" {                                   
                                                          
         constraints {                                                          
                                                          
             format(inList: ['json', 'xml', 'html', 'csv'])                     
                                                          
         }                                                                      
                                                          
     }                                                                          
                                                          
     // Second: fallback for IDs with dots but no valid format                  
                                                          
     "/$controller/$action/$id"()  
   ```
   
     | URL | id | format | Which mapping? |                                     
                                                          
     |-----|-----|--------|----------------|                                    
                                                          
     | `/user/show/bob.smith` | `bob.smith` | `null` | Fallback (no valid 
format) |                                                       
     | `/user/show/bob.smith.json` | `bob.smith` | `json` | Greedy (valid 
format) |                                                       
     | `/user/show/bob.smith.jones` | `bob.smith.jones` | `null` | Fallback (no 
valid format) |                                           
     | `/user/show/bob.smith.jones.xml` | `bob.smith.jones` | `xml` | Greedy 
(valid format) |  


-- 
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]

Reply via email to