Comment on page
RESTFul Extension Detection
ColdBox allows you to detect incoming extensions from incoming paths automatically for you. This is great for building multi-type responses or to just create virtual extensions for events.
If an extension is detected in the incoming URL, ColdBox will grab it and store it in the request collection (
RC) as the variable
format. If there is no extension, then
rc.formatwill not be stored and thus will not exist.
http://localhost/users => rc.format is null, does not exist
http://localhost/users.json => rc.format = json
http://localhost/users.xml => rc.format = xml
http://localhost/users.pdf => rc.format = pdf
http://localhost/users.html => rc.format = html
You can configure the extension detection using the following configuration methods:
Please note that if you have set to throw exceptions if an invalid extension is detected then a 406 exception will be thrown.