The Reserved Routes interceptor is quite simple but helpful. It should be loaded in your applicatons ColdBox Config file after the SES Interceptor. It then pulls the SES interceptor from the ColdBox Cache, extracts the routes and reserves any static strings in the first position of your URL.
EXAMPLE OF STATIC ROUTE RESERVATON
- addRoute(pattern='about/:version?', handler='General', action='index');
- The above route declaration would result in the ReservedRoutes interceptor generating a reserved string of 'about'.
DYNAMIC FIRST POSITION ROUTES ARE NOT RESERVED
- The above route declaration would not result in any reserved strings as the first element in the list is dynamic.
WHY WAS THIS INTERCEPTOR CREATED
This interceptor was created to allow users to have their own URLs such as mywebsite.com/:username. During the registration process, their username is compared to my reserved routes. I also add additional strings to the reserved list to exclude words I do not wish users to have (such as bad words).
Add the interceptor to your ColdBox config AFTER the SES interceptor.
//RESERVE SES ROUTES
Step 2:When you need to get your reserved routes, just use the getSetting('ReservedRoutes'); syntax
When you declare the interceptor in the ColdBox configuration file, you can provide a list of custom terms to reserve, Example:
Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.
||Dec 29 2009 09:58 PM
||Jun 09 2016 03:24 PM