ColdBox Interceptors SES Config Path

I have been digging through the different settings in the coldbox.xml to see how things work and I came across something with the configFile path property for the SES Interceptor. On line 40 of the ses.cfc interceptor, any leading slashes are stripped off of the config file path before it is used. Can somebody explain why this is as this prevents the configFile path property from being set using a ColdFusion mapping?

Thanks

– Jeff

I believe this is the line you are talking about:

      configFilePath = configFilePath & reReplace(getProperty
('ConfigFile'),"^/","");

The reReplace(getProperty('ConfigFile'),"^/","") removes just the
leading slash, configFilePath's previous value is still added on to
the beginning.

Notice that configFilePath is prepended to this reReplace, so your
appMapping (which should contain your ColdFusion mapping) is what will
contain this part of the mapping and is tacked on to the beginning of
the configFile after it has its slash removed. Since it is prepended,
then your CF mapping will also be prepended.

It is set at the beginning of config:

      var configFilePath = "/";

So that slash will always be there, then if appMapping is populated,
it is added on to this configFilePath here:

  if( getController().getSetting('AppMapping') neq "" ){
        configFilePath = configFilePath & getController().getSetting
('AppMapping') & "/";
        }

I did a quick test (on my Windows box right now) by adding this
function to write the progression of the configFilePath to a file.

<cffunction name="writeOut" access="public" returntype="none"
output="true">
  <cfargument name="outputVar" type="string">
  <cfif #arguments.outputVar# is 'clear'>
  <cffile action="write" output="" file="c:\test.htm"
nameconflict="overwrite">
  <cfelse>
  <cffile action="append" output="<br>#outputVar#" file="c:\test.htm">
  </cfif>
</cffunction>

And then modifying configure to write to it...

<cfscript>
      writeOut('clear');
      var configFilePath = "/";
      writeOut('1.) ' & configFilePath);

      /* If AppMapping is not Blank check */
      if( getController().getSetting('AppMapping') neq "" ){
        configFilePath = configFilePath & getController().getSetting
('AppMapping') & "/";
      writeOut('2.) ' & configFilePath);
      }
      /* Setup the default properties */
      set_courses( ArrayNew(1) );
      setUniqueURLs(true);
      setEnabled(true);

      /* Verify the properties */
      if( not propertyExists('configFile') ){
        throw('The configFile property has not been defined. Please define
it.','','interceptors.ses.configFilePropertyNotDefined');
      }

      /* Setup the config Path */
      writeOut('3.) ' & configFilePath);
      writeOut('4.) ' & getProperty('ConfigFile'));
      writeOut('5.) ' & reReplace(getProperty('ConfigFile'),"^/",""));
      configFilePath = configFilePath & reReplace(getProperty
('ConfigFile'),"^/","");
      writeOut('6.) ' & configFilePath);
      /* We are ready to roll. Import config to setup the routes. */
      try{
        include(configFilePath);
      }
      catch(Any e){
        throw("Error including config file:
#e.message#",e.detail,"interceptors.ses.executingConfigException");
      }

If you do this this, you'll see that the appMapping is maintained,
then added back to the configFilePath.

Sorry if I wasn't clear, but it seems to be working as intended for
me...

If your CF mapping is defined in the appMapping, then it will
definitely be appended to the beginning.

whostheJBoss,

My mistake, I misread that line of code. It would appear that the issue is
actually with my AppMapping setting, so I will have to play with that one to
see what the right path should be.

Thanks for the clarification.
-- Jeff