Can Interceptors be defined in enviroments.xml

Can I use the environments control interceptor to setup the class paths for other interceptors? Likewise, I have to define the class path to the environment control interceptor itself which is different for each branch and the trunk. For instance, in my coldbox config I have the following:

config/environments.xml.cfm true

How do I make those paths dynamic so I don’t have to update them for each enivronment?

Thanks,
Aaron

Noting that the EnvironmentController wiki (http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbEnvironmentControl) states that the settings structure can be dumped to look up the variables paths and then use dot notation or JSON I have tried the following in my environments.xml config but to no avail:

Also to no avail I have tried:

Unfortunately, unlike the example and most other settings, the interceptor definitions are an array within a struct.

Again, is it possible to use the environments control interceptor to setup the class paths for other interceptors?

Thanks,
Aaron

I don't know if this will help in your situation but this is how I
handle the different environments.

1. Each application gets its own copy of the framework
2. In Application.cfc (the one without inheritance), I create two
mappings like these

<cfset COLDBOX_APP_ROOT_PATH =
getDirectoryFromPath(getCurrentTemplatePath())>

<cfset this.mappings["/coldbox"] = COLDBOX_APP_ROOT_PATH &
"\frameworks\coldbox\3_0\coldbox\">
<cfset this.mappings["/myApplicationDirectory"] = COLDBOX_APP_ROOT_PATH>

3. This then allows me to do stuff like below. For coldbox core
interceptors, it hits the first mapping. For my own interceptors, it
hits the second.

<Interceptor class="coldbox.system.interceptors.environmentControl">
            <Property
name='configFile'>config/environments.xml.cfm</Property>
            <Property name='fireOnInit'>true</Property>
</Interceptor>
<Interceptor class="coldbox.system.interceptors.security" />
<Interceptor
class="myApplicationDirectory.interceptors.myOwnInterceptor" />

Again, I don't know if this will work with your setup but it may help
you find a solution. In short, my paths are not hard coded as they refer
to the mappings. The mappings then dynamically figure out where they are
and so it all stitches itself together regardless of the location of the
files.

- Gabriel

Aaron Roberson wrote:

Gabriel,

I think your suggestion may just work. However, this.mapping does not seem to be working.

I put <cfset this.mapping["/myapp"] = COLDBOX_APP_ROOT_PATH> in Application.cfc like you suggested. I even changed this.name so that it would register the change. Unfortunately though, when I reinit the framework and load the app it says:

Could not find the ColdFusion Component or Interface root.interceptors.environmentControl

I’m going to check to see if my admin has enabled per application settings to see if that’s the problem and then I’ll report back.

1. Is "root" the mapping you're using for the coldbox framework? The
environment interceptor is part of the coldbox core so you'd want to
call it from the root path of your app down to where the coldbox
framework files are.

For example, the example below is saying: start at "coldbox" and go
"coldbox/system/interceptors/environmentControl.cfc" and you'll find
what you need (assuming the "coldbox" mapping from my previous email
exists).

<Interceptor class="coldbox.system.interceptors.environmentControl">

2. Your error is basically saying that it can't find
"root/interceptors/environmentControl.cfc" assuming you're using the
line below:

<Interceptor class="root.interceptors.environmentControl">

- Gabriel

  1. Is “root” the mapping you’re using for the coldbox framework? The
    environment interceptor is part of the coldbox core so you’d want to
    call it from the root path of your app down to where the coldbox
    framework files are.

root is the mapping i’m using for the app root. I have the mapping <cfset this.mapping["/root"] = COLDBOX_APP_ROOT_PATH>.

I want that class path to start at root/interceptors/environmentControl.cfc because I have an EnvironmentControl class in my interceptors folder that extends the coldbox one (I’m overriding one of the methods). We also have a system wide mapping to coldbox so an app specific mapping to it is not necessary.

For example, the example below is saying: start at “coldbox” and go
“coldbox/system/interceptors/environmentControl.cfc” and you’ll find
what you need (assuming the “coldbox” mapping from my previous email
exists).

  1. Your error is basically saying that it can’t find
    “root/interceptors/environmentControl.cfc” assuming you’re using the
    line below:
  • Gabriel

Yeah I’m using because I have a custom component located in the interceptors folder of my app that extends the coldbox.system.interceptors.environmentControl.cfc and overrides the detectEnvironment() method.