Handlers, plugins, views etc off webroot

Hey guys,

Surprised I couldn’t find an answer to this, but apparently my searching skills have failed me today.

I’m doing a legacy->coldbox migration and both apps are going to live side by side for a while, and in the legacy app, there are a bunch of folders and files already in the web root.

For that reason (and some others), I want to have my handlers, plugins, views etc to be off the webroot, and managed by ColdFusion mappings.

My Config Coldbox.cfc was easy, so no issues there.

I made the (blatant?) assumption I could add a mapping of “handlers” and CB would go looking for “/handlers” and all would be well and good. However, it doesn’t look like that is the case, as it always looked in my web root.

So - stupid question of the day - how can I set up CB to look at a mapping for my handlers, views, etc?

I’m happy to have my mapping in any way, shape of form, but I’d really like these conventions to be looking under my mappings, rather than my web root.

I can’t seem to see an answer in the documentation, so any help would be appreciated.

Running ColdBox SVN version.

Cheers,

Mark

Hi Mark,

I don’t know why mappings doesn’t work, but you could override the ColdBox conventions and simply change the handlers directory path:
http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbDirectoryStructure#ModifyingFramework-WideConventions

Does that help?

  • John

Yeah, I tried that.

I now have:
var root = “…/mapped/app/”;
conventions = {
handlersLocation = “#root#handlers”
,pluginsLocation = “#root#plugins”
,viewsLocation = “#root#views”
,layoutsLocation = “#root#layouts”
,modelsLocation = “#root#model”
,modulesLocation = “#root#modules”
};

What happens when I hit a request is:

Error Messages: The …mapped.app.handlers.General name is not a valid component or interface name.
Component and interface names cannot be empty and cannot start or end with a period.

So it appends the …/ to the handler location.

So that doesn’t work either :frowning:

Or did you mean something else?

Mark

I haven’t done it, but I believe that the handlers path needs to be dotted so:

conventions = {

handlersLocation = “mymapping.myhandlers”
}

Mark,

The handlersLocation, pluginsLocation, and modelsLocation are to be dot notation paths. You can certainly use a coldfusion mapping.

http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbEventHandlersGuide#EventHandlersLocation

http://wiki.coldbox.org/wiki/Models.cfm#Conventions_Location

The viewsLocation, layoutsLocation, and modulesLocation are standard paths and coldfusion mappings can be used for these also.

Hope that helps,

Curt Gratz

Computer Know How

Mark,

You can also use the external locations instead which can be anywhere in the server.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Curt, I just tried this.

No go.

var root = “app.”;

//Conventions
conventions = {
handlersLocation = “#root#handlers”
,pluginsLocation = “#root#plugins”
,viewsLocation = “#root#views”
,layoutsLocation = “#root#layouts”
,modelsLocation = “#root#model”
,modulesLocation = “#root#modules”
};

I set up a mapping /app to my off root directory.

The handlers directory: /home/developer/src/wwwroot/app.handlers does not exist please check your application structure or your Application Mapping.:frowning:

Mark

Luis,

If i do that, I still have to have empty directories in my web root - no? I’d really prefer not to do that, it’s just going to make things messier than they already are.

Mark