Ok I think it might be because I don’t write the interceptor definitions, and I do it this way in my module onLoad().
var moduleRoot = expandPath(interceptorPath);
var files = DirectoryList(moduleRoot, false, “query”, “*.cfc”);
for(var count=1; count <= files.recordCount; count++) {
var interceptorName = listGetAt(files[‘name’][count], 1, ‘.’);
var interceptorClass = right(interceptorPath, len(interceptorPath)-1);
var interceptorClass = reReplace(interceptorClass & ‘/’ & interceptorName, ‘/’, ‘.’, ‘ALL’);
arrayAppend(instance.interceptors, interceptorName);
controller.getInterceptorService().registerInterceptor(interceptorClass=interceptorClass, interceptorName=interceptorName);
}
I then have an interceptor that has this, and this is setup with the above code.
property name=“applicationStorage” inject=‘coldbox:plugin:ApplicationStorage’;
property name=“logger” inject=‘logbox’;
public void function preProcess(event, interceptorData) {
applicationStorage.setVar(‘andyscotttest’, ‘something for everyone’);
log = logger.getLogger(this);
log.info(‘aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa’);
}
If I do a fwreinit on the application I find that I get an error on the applicationStorage.setVar() line above.
P.S. I find this way of just dropping an interceptor in much easier to maintain, than searching for config options or where it is etc. I am alos in the process of when loading this to do then load the metadata and see if the annotations are present. This would hopefully mimic manually creating it via the Config.cfc definition.
Especially when they aren’t complex and require no passed arguments on instantiation.
Regards,
Andrew Scott
http://www.andyscott.id.au/