FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

Reserved Routes

v1 Public
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
  • addRoute(':handler/:action?');
  • 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).


Step 1
Add the interceptor to your ColdBox config AFTER the SES interceptor.
//SES {class="coldbox.system.interceptors.SES", properties={} }, //RESERVE SES ROUTES {class="interceptors.ReserveRoutes", properties={} }
Step 2:When you need to get your reserved routes, just use the getSetting('ReservedRoutes'); syntax

Optional
When you declare the interceptor in the ColdBox configuration file, you can provide a list of custom terms to reserve, Example: {class="interceptors.ReserveRoutes", properties={custom='DontAllowThisWord,SomethingUnacceptable,Dont-Allow-This-Work,Or-This-One'} },

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.

Version Created Last Update Published By Stable Actions
Current
1 Dec 29 2009 09:58 PM Jun 09 2016 03:24 PM

 

No collaborators yet.
 
3.00 / 2
  • Dec 29 2009 09:58 PM
  • Jun 09 2016 03:24 PM
  • 6,185
  • 2,790
  • 1